Added oidc service to webapi with a dumb way of authenticating incoming tokens
This commit is contained in:
16
WebAPI/Controllers/BaseController.cs
Normal file
16
WebAPI/Controllers/BaseController.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
|
||||
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()
|
||||
: String.Empty;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user