Beispiel #1
0
 public ClientAssertion(string subject, string audience)
 {
     Subject    = subject;
     Issuer     = subject;
     Audience   = audience;
     JwtId      = Guid.NewGuid().ToString("N");
     IssuedAt   = DateTime.UtcNow;
     Expiration = IssuedAt.AddSeconds(30);
 }
 public DateTime CalculateExpiration()
 {
     return(IssuedAt
            .AddSeconds(ExpiresIn)
            .AddMinutes(-ExpiryBuffer));
 }
Beispiel #3
0
 /// <summary>
 /// Returns true if the token will expired based on the current system clock and the calculated <see cref="ExpiresAt"/> value.
 /// </summary>
 public bool IsExpiring()
 {
     return(DateTime.Now >= IssuedAt.AddSeconds(ExpiresIn / 90d));
 }
 /// <summary>
 /// Determine whether the token has expired
 /// </summary>
 /// <param name="time"></param>
 /// <returns></returns>
 public bool IsExpired(DateTimeOffset time)
 {
     return(IssuedAt.AddSeconds(ExpiresIn) < time);
 }