public TokenValidationOptions()
        {
            var tokenSecrets = new TokenSecrets();
            var tokenOptions = new TokenOptions();

            TokenValidationParameters = new TokenValidationParameters
            {
                ValidateIssuerSigningKey = true,
                IssuerSigningKey         = tokenSecrets.SigningKey,

                ValidateIssuer = true,
                ValidIssuer    = tokenOptions.Issuer,

                ValidateAudience = true,
                ValidAudience    = tokenOptions.Audience,

                ValidateLifetime = true,

                ClockSkew = TimeSpan.FromSeconds(30)
            };

            SupportedSchemes = new List <string>
            {
                "Bearer"
            };
        }
예제 #2
0
        public TokenGenerationOptions()
        {
            var tokenSecrets = new TokenSecrets();

            Expiration         = TimeSpan.FromHours(4);
            SigningCredentials = new SigningCredentials(tokenSecrets.SigningKey, SecurityAlgorithms.HmacSha256);
        }