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

@@ -1,5 +1,7 @@
using System;
using System.Linq;
using System.Security.Claims;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Net.Http.Headers;
@@ -7,10 +9,5 @@ namespace WebAPI.Controllers
{
public class BaseController : ControllerBase
{
protected string BearerToken =>
Request.Headers.Keys.Contains(HeaderNames.Authorization) &&
Request.Headers[HeaderNames.Authorization].Count > 0
? Request.Headers[HeaderNames.Authorization].First().Split(" ")[1]
: String.Empty;
}
}