public void UpdateToken()

        {
            IssuedAt = DateTime.UtcNow;

            NotBefore = IssuedAt;

            Expiration = IssuedAt.Add(ValidFor);
        }
Esempio n. 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);
        }
Esempio n. 3
0
 public DateTime Expiration() => IssuedAt.Add(ValidFor);