This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Authorize(AuthenticationSchemes = "api")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.AddAuthentication(o => o.AddScheme("api", a => a.HandlerType = typeof(TokenHandler))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class TokenHandler : AuthenticationHandler | |
{ | |
private const ulong _REQUEST_MAX_AGE_IN_SECONDS = 300; //5 mins | |
private const string _AUTHENTICATION_SCHEME = "amx"; | |
private static readonly DateTime _1970 = new DateTime(1970, 01, 01, 0, 0, 0, 0, DateTimeKind.Utc); | |
private static readonly Dictionary _AllowedApps = new Dictionary(); | |
private readonly IMemoryCache _cache; | |
public TokenHandler(IMemoryCache memoryCache, IOptionsMonitor options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) |