public void UpdateToken()

        {
            IssuedAt = DateTime.UtcNow;

            NotBefore = IssuedAt;

            Expiration = IssuedAt.Add(ValidFor);
        }
Пример #2
0
        public JwtIssuerFactory(IOptions <JwtIssuerSettings> options)
        {
            Issuer   = options.Value.Issuer;
            Audience = options.Value.Audience;

            IssuedAt  = DateTime.UtcNow;
            NotBefore = IssuedAt;

            ValidFor = TimeSpan.FromMinutes(options.Value.ValidFor);
            Expires  = IssuedAt.Add(ValidFor);

            var key = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(options.Value.SecretKey));

            SigningCredentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
        }
Пример #3
0
 public DateTime Expiration() => IssuedAt.Add(ValidFor);