public async Task <GenerateTokenResult> GenerateToken(AuthorizeTokensRepository tokenRepos, string status, SignatureAuthorizationFactory factory) { var result = await Task.Run(() => factory.CreateToken(Guid.NewGuid())); if (status == "success") { tokenRepos.Add(result.Item1); } var total = new GenerateTokenResult() { Status = status, Token = status == "success" ? Convert.ToBase64String(result.Item2) : "" }; return(total); }
public AuthorizationMiddleware(TokenAuthSettings _settings, IOptionsMonitor <TokenAuthSettings> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, AuthorizeTokensRepository _repos) : base(options, logger, encoder, clock) { settings = _settings; repos = _repos; }