public string GetDataToSign() { return(Occ.Length + Occ + ExternalUniqueNumber.Length + ExternalUniqueNumber + ReverseCode.Length + ReverseCode + IssuedAt.ToString().Length + IssuedAt.ToString()); }
public string GetDataToSign() { return(ExternalUniqueNumber.Length + ExternalUniqueNumber + Total.ToString().Length + Total.ToString() + ItemsQuantity.ToString().Length + ItemsQuantity.ToString() + IssuedAt.ToString().Length + IssuedAt.ToString() + CallbackUrl.Length + CallbackUrl); }
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 void UpdateToken() { IssuedAt = DateTime.UtcNow; NotBefore = IssuedAt; Expiration = IssuedAt.Add(ValidFor); }
public string GetDataToSign() { string ret = Occ.Length + Occ + AuthorizationCode.Length + AuthorizationCode + IssuedAt.ToString().Length + IssuedAt.ToString() + Amount.ToString().Length + Amount.ToString() + InstallmentsAmount.ToString().Length + InstallmentsAmount.ToString() + InstallmentsNumber.ToString().Length + InstallmentsNumber.ToString() + BuyOrder.Length + BuyOrder; return(ret); }
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); }
public IDictionary <string, object> ToDictionary() { return((AdditionalClaims ?? new Dictionary <string, object>()).Concat( new Dictionary <string, object> { ["iss"] = Issuer, ["sub"] = Subject, ["aud"] = Audience, ["exp"] = Expiration?.ToString(_iso8601Format, CultureInfo.InvariantCulture), ["nbf"] = NotBefore?.ToString(_iso8601Format, CultureInfo.InvariantCulture), ["iat"] = IssuedAt?.ToString(_iso8601Format, CultureInfo.InvariantCulture), ["jti"] = TokenIdentifier, } ).Where(x => x.Value != null).ToDictionary(x => x.Key, x => x.Value)); }
public DateTime CalculateExpiration() { return(IssuedAt .AddSeconds(ExpiresIn) .AddMinutes(-ExpiryBuffer)); }
public bool HasExpired() => DateTime.UtcNow - IssuedAt.ToUniversalTime() >= ExpiresIn;
/// <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)); }
public DateTime Expiration() => IssuedAt.Add(ValidFor);
public long ToUnixEpochDate() => (long)Math.Round((IssuedAt.ToUniversalTime() - new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero)).TotalSeconds);
/// <summary> /// Determine whether the token has expired /// </summary> /// <param name="time"></param> /// <returns></returns> public bool IsExpired(DateTimeOffset time) { return(IssuedAt.AddSeconds(ExpiresIn) < time); }