You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/protocol-endpoints.adoc
+65Lines changed: 65 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -266,6 +266,71 @@ The supported https://datatracker.ietf.org/doc/html/rfc6749#section-1.3[authoriz
266
266
* `*AuthenticationSuccessHandler*` -- An internal implementation that handles an `OAuth2AccessTokenAuthenticationToken` and returns the `OAuth2AccessTokenResponse`.
267
267
* `*AuthenticationFailureHandler*` -- An `OAuth2ErrorAuthenticationFailureHandler`.
=== Customizing Client Credentials Grant Request Validation
271
+
272
+
`OAuth2ClientCredentialsAuthenticationValidator` is the default validator used for validating specific OAuth2 Client Credentials Grant request parameters.
273
+
The default implementation validates the `scope` parameter.
274
+
If validation fails, an `OAuth2AuthenticationException` is thrown.
275
+
276
+
`OAuth2ClientCredentialsAuthenticationProvider` provides the ability to override the default request validation by supplying a custom authentication validator of type `Consumer<OAuth2ClientCredentialsAuthenticationContext>` to `setAuthenticationValidator()`.
277
+
278
+
[TIP]
279
+
`OAuth2ClientCredentialsAuthenticationContext` holds the `OAuth2ClientCredentialsAuthenticationToken`, which contains the OAuth2 Client Credentials Grant request parameters.
280
+
281
+
[IMPORTANT]
282
+
If validation fails, the authentication validator *MUST* throw `OAuth2AuthenticationException`.
283
+
284
+
The following example shows how to configure `OAuth2ClientCredentialsAuthenticationProvider` with a custom authentication validator that overrides the default `scope` validation:
285
+
286
+
[source,java]
287
+
----
288
+
@Bean
289
+
public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http) throws Exception {
0 commit comments