Skip to content

Commit a8c2f71

Browse files
Minor refactoring
Update comment. Update XML documentation. Remove throw.
1 parent 9eea475 commit a8c2f71

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/AspNet.Security.OAuth.Keycloak/KeycloakAuthenticationOptions.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public KeycloakAuthenticationOptions()
3838
}
3939

4040
/// <summary>
41-
/// Gets or sets the value for Keycloak client's access type.
41+
/// Gets or sets the value for the Keycloak client's access type.
4242
/// </summary>
4343
public KeycloakAuthenticationAccessType AccessType { get; set; }
4444

@@ -62,20 +62,17 @@ public override void Validate()
6262
{
6363
try
6464
{
65-
// HACK
66-
// We want all of the base validation except for ClientSecret,
65+
// HACK We want all of the base validation except for ClientSecret,
6766
// so rather than re-implement it all, catch the exception thrown
6867
// for that being null and only throw if we aren't using public access type.
6968
// This does mean that three checks have to be re-implemented
7069
// because the won't be validated if the ClientSecret validation fails.
7170
base.Validate();
7271
}
73-
catch (ArgumentException ex) when (ex.ParamName == nameof(ClientSecret))
72+
catch (ArgumentException ex) when (ex.ParamName == nameof(ClientSecret) && AccessType == KeycloakAuthenticationAccessType.Public)
7473
{
75-
if (AccessType != KeycloakAuthenticationAccessType.Public)
76-
{
77-
throw;
78-
}
74+
// No client secret is required for a public key.
75+
// See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers/issues/610.
7976
}
8077

8178
if (string.IsNullOrEmpty(AuthorizationEndpoint))

0 commit comments

Comments
 (0)