예제 #1
0
        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);
        }
예제 #2
0
 public AuthorizationMiddleware(TokenAuthSettings _settings, IOptionsMonitor <TokenAuthSettings> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, AuthorizeTokensRepository _repos)
     : base(options, logger, encoder, clock)
 {
     settings = _settings;
     repos    = _repos;
 }