in src/Microsoft.Azure.SignalR.Common/Auth/JwtPayload.cs [34:71]
public JwtPayload(string issuer = null, string audience = null, IEnumerable<Claim> claims = null, DateTime? notBefore = null, DateTime? expires = null, DateTime? issuedAt = null)
{
if (claims != null)
{
AddClaims(claims);
}
if (expires.HasValue)
{
if (notBefore.HasValue)
{
if (notBefore.Value >= expires.Value)
{
throw LogHelper.LogExceptionMessage(new ArgumentException(LogHelper.FormatInvariant("IDX12401: Expires: '{0}' must be after NotBefore: '{1}'.", expires.Value, notBefore.Value)));
}
this[JwtRegisteredClaimNames.Nbf] = EpochTime.GetIntDate(notBefore.Value.ToUniversalTime());
}
this[JwtRegisteredClaimNames.Exp] = EpochTime.GetIntDate(expires.Value.ToUniversalTime());
}
if (issuedAt.HasValue)
{
this[JwtRegisteredClaimNames.Iat] = EpochTime.GetIntDate(issuedAt.Value.ToUniversalTime());
}
if (!string.IsNullOrEmpty(issuer))
{
this[JwtRegisteredClaimNames.Iss] = issuer;
}
// if could be the case that some of the claims above had an 'aud' claim;
if (!string.IsNullOrEmpty(audience))
{
AddClaim(new Claim(JwtRegisteredClaimNames.Aud, audience, ClaimValueTypes.String));
}
}