Skip to content

Commit

Permalink
Remove support for Client Secret and HS256
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikprijck committed Nov 27, 2023
1 parent 3df218e commit dcb3513
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
5 changes: 0 additions & 5 deletions src/Auth0.OidcClient.Core/Auth0ClientBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ private OidcClientOptions CreateOidcClientOptions(Auth0ClientOptions options)
}
};

#pragma warning disable CS0618 // ClientSecret will be removed in a future update.
if (!String.IsNullOrWhiteSpace(oidcClientOptions.ClientSecret))
oidcClientOptions.ClientSecret = options.ClientSecret;
#pragma warning restore CS0618

if (options.RefreshTokenMessageHandler != null)
oidcClientOptions.RefreshTokenInnerHttpHandler = options.RefreshTokenMessageHandler;

Expand Down
7 changes: 0 additions & 7 deletions src/Auth0.OidcClient.Core/Auth0ClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ public class Auth0ClientOptions
/// </summary>
public string ClientId { get; set; }

/// <summary>
/// Your Auth0 Client Secret.
/// </summary>
[Obsolete("Client Secrets should not be used in non-confidential clients such as native desktop and mobile apps. " +
"This property will be removed in a future release.")]
public string ClientSecret { get; set; }

/// <summary>
/// Your Auth0 tenant domain.
/// </summary>
Expand Down
8 changes: 3 additions & 5 deletions src/Auth0.OidcClient.Core/Tokens/IdTokenValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ internal async Task AssertTokenMeetsRequirements(IdTokenRequirements required, s
throw new IdTokenValidationException("ID token is required but missing.");

var token = DecodeToken(rawIDToken);

// For now we want to support HS256 + ClientSecret as we just had a major release.
// TODO: In the next major (v4.0) we should remove this condition as well as Auth0ClientOptions.ClientSecret
if (token.SignatureAlgorithm != "HS256")
(signatureVerifier ?? await assymetricSignatureVerifier.ForJwks(required.Issuer)).VerifySignature(rawIDToken);

if (signatureVerifier != null)
(await assymetricSignatureVerifier.ForJwks(required.Issuer)).VerifySignature(rawIDToken);

AssertTokenClaimsMeetRequirements(required, token, pointInTime ?? DateTime.Now);
}
Expand Down

0 comments on commit dcb3513

Please sign in to comment.