public void SetClaim(ClaimID claim, JSON value) { string keyName; switch (claim) { case ClaimID.Issuer: keyName = "iss"; break; case ClaimID.Subject: keyName = "sub"; break; case ClaimID.Audience: keyName = "aud"; break; case ClaimID.ExpirationTime: keyName = "exp"; break; case ClaimID.NotBefore: keyName = "nbf"; break; case ClaimID.IssuedAt: keyName = "iat"; break; case ClaimID.CWTId: keyName = "jti"; break; default: throw new JwtException("Unknown claim ID"); } SetClaim(keyName, value); }
public void SetClaim(ClaimID claim, DateTime dt) { double unixTime = (TimeZoneInfo.ConvertTimeToUtc(dt) - new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc)).TotalSeconds; JSON value = JSON.FromObject(unixTime); SetClaim(claim, value); }
public void SetClaim(ClaimID claim, DateTime dt) { double unixTime = (TimeZoneInfo.ConvertTimeToUtc(dt) - new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc)).TotalSeconds; CBORObject value = CBORObject.FromObject((long)unixTime); value = CBORObject.FromObjectAndTag(value, 1); SetClaim(claim, value); }
public string ToConsoleString() { return(string.Join("\t", new string[] { ClaimID.ToString(), ClaimType.ToString(), Description.PadRight(30), ClaimAmount.ToString("C").PadLeft(10), DateOfIncident.ToShortDateString(), DateOfClaim.ToShortDateString(), IsValid.ToString() })); }
public void SetClaim(ClaimID claim, CBORObject value) { SetClaim(CBORObject.FromObject((Int32)claim), value); }
public void SetClaim(ClaimID claim, string value) { SetClaim(claim, CBORObject.FromObject(value)); }