File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
src/AspNet.Security.OAuth.Keycloak Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public KeycloakAuthenticationOptions()
38
38
}
39
39
40
40
/// <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.
42
42
/// </summary>
43
43
public KeycloakAuthenticationAccessType AccessType { get ; set ; }
44
44
@@ -62,20 +62,17 @@ public override void Validate()
62
62
{
63
63
try
64
64
{
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,
67
66
// so rather than re-implement it all, catch the exception thrown
68
67
// for that being null and only throw if we aren't using public access type.
69
68
// This does mean that three checks have to be re-implemented
70
69
// because the won't be validated if the ClientSecret validation fails.
71
70
base . Validate ( ) ;
72
71
}
73
- catch ( ArgumentException ex ) when ( ex . ParamName == nameof ( ClientSecret ) )
72
+ catch ( ArgumentException ex ) when ( ex . ParamName == nameof ( ClientSecret ) && AccessType == KeycloakAuthenticationAccessType . Public )
74
73
{
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.
79
76
}
80
77
81
78
if ( string . IsNullOrEmpty ( AuthorizationEndpoint ) )
You can’t perform that action at this time.
0 commit comments