Added userinfo endpoint usage and api now properly creates necessary claims to start doing database stuff

This commit is contained in:
2021-10-18 11:06:44 -04:00
parent 320d939c76
commit 9e6c7f33a5
13 changed files with 129 additions and 88 deletions

View File

@@ -5,12 +5,13 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using WebAPI.Auth;
using WebAPI.Data;
namespace WebAPI.Controllers
{
[Authorize(Policy = "test")]
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class HelloWorldController : BaseController
@@ -25,7 +26,14 @@ namespace WebAPI.Controllers
[HttpGet]
public async Task<string> HelloWorld()
{
return "Success";
return JsonConvert.SerializeObject(User.Claims.Select(claim => new {claim.Type, claim.Value}));
}
[HttpGet]
[Route("NameRequired")]
public string NameRequired()
{
return "success";
}
}