Skip to content

Commit

Permalink
Added missing standard claims.
Browse files Browse the repository at this point in the history
  • Loading branch information
Franco Fung committed Jun 6, 2024
1 parent 12cd3dc commit 825754a
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Licensed under the MIT License.

using System;
using System.Text;

namespace Microsoft.IdentityModel.JsonWebTokens
{
/// <summary>
/// List of registered claims from different sources
/// https://datatracker.ietf.org/doc/html/rfc7519#section-4
/// http://openid.net/specs/openid-connect-core-1_0.html#IDToken
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public struct JwtRegisteredClaimNames
{
Expand All @@ -24,6 +24,11 @@ public struct JwtRegisteredClaimNames
/// </summary>
public const string Acr = "acr";

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims //TODO: clarify if this should be a JSON obj based on spec?
/// </summary>
public const string Address = "address";

/// <summary>
/// http://openid.net/specs/openid-connect-core-1_0.html#IDToken
/// </summary>
Expand Down Expand Up @@ -64,6 +69,11 @@ public struct JwtRegisteredClaimNames
/// </summary>
public const string Email = "email";

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims //TODO: clarify if this should be a Boolean based on spec?
/// </summary>
public const string EmailVerified = "email_verified";

/// <summary>
/// https://datatracker.ietf.org/doc/html/rfc7519#section-4
/// </summary>
Expand Down Expand Up @@ -99,6 +109,17 @@ public struct JwtRegisteredClaimNames
/// </summary>
public const string Jti = "jti";


/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string Locale = "locale";

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string MiddleName = "middle_name";

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
Expand All @@ -108,6 +129,11 @@ public struct JwtRegisteredClaimNames
/// </summary>
public const string NameId = "nameid";

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string Nickname = "nickname";

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
/// </summary>
Expand All @@ -129,9 +155,25 @@ public struct JwtRegisteredClaimNames
public const string PhoneNumberVerified = "phone_number_verified";

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string Picture = "picture";

/// <summary>
/// TODO:Add description?
/// </summary>
public const string Prn = "prn";

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string PreferredUsername = "preferred_username";

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string Profile = "profile";

/// <summary>
/// http://openid.net/specs/openid-connect-frontchannel-1_0.html#OPLogout
/// </summary>
Expand All @@ -152,8 +194,19 @@ public struct JwtRegisteredClaimNames
public const string UniqueName = "unique_name";

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string UpdatedAt = "updated_at";

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string Website = "website";

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string ZoneInfo = "zoneinfo";
}

/// <summary>
Expand Down
50 changes: 50 additions & 0 deletions src/System.IdentityModel.Tokens.Jwt/JwtRegisteredClaimNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public struct JwtRegisteredClaimNames
/// </summary>
public const string Amr = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Amr;

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims //TODO: clarify if this should be a JSON obj based on spec?
/// </summary>
public const string Address = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Address;

/// <summary>
/// https://datatracker.ietf.org/doc/html/rfc7519#section-4
/// </summary>
Expand Down Expand Up @@ -59,6 +64,11 @@ public struct JwtRegisteredClaimNames
/// </summary>
public const string Email = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Email;

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims //TODO: clarify if this should be a Boolean based on spec?
/// </summary>
public const string EmailVerified = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.EmailVerified;

/// <summary>
/// https://datatracker.ietf.org/doc/html/rfc7519#section-4
/// </summary>
Expand Down Expand Up @@ -94,6 +104,16 @@ public struct JwtRegisteredClaimNames
/// </summary>
public const string Jti = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Jti;

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string Locale = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Locale;

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string MiddleName = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.MiddleName;

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
Expand All @@ -103,6 +123,11 @@ public struct JwtRegisteredClaimNames
/// </summary>
public const string NameId = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.NameId;

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string Nickname = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Nickname;

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
/// </summary>
Expand All @@ -113,10 +138,25 @@ public struct JwtRegisteredClaimNames
/// </summary>
public const string Nbf = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Nbf;

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string Picture = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Picture;

/// <summary>
/// </summary>
public const string Prn = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Prn;

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string PreferredUsername = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.PreferredUsername;

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string Profile = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Profile;

/// <summary>
/// http://openid.net/specs/openid-connect-frontchannel-1_0.html#OPLogout
/// </summary>
Expand All @@ -136,8 +176,18 @@ public struct JwtRegisteredClaimNames
/// </summary>
public const string UniqueName = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.UniqueName;

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string UpdatedAt = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.UpdatedAt;

/// <summary>
/// </summary>
public const string Website = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Website;

/// <summary>
/// https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
/// </summary>
public const string ZoneInfo = Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.ZoneInfo;
}
}

0 comments on commit 825754a

Please sign in to comment.