Class OAuth2AuthorizationConsentAuthenticationProvider
java.lang.Object
org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationConsentAuthenticationProvider
- All Implemented Interfaces:
org.springframework.security.authentication.AuthenticationProvider
public final class OAuth2AuthorizationConsentAuthenticationProvider
extends Object
implements org.springframework.security.authentication.AuthenticationProvider
An
AuthenticationProvider
implementation for the OAuth 2.0 Authorization Consent
used in the Authorization Code Grant.-
Constructor Summary
ConstructorDescriptionOAuth2AuthorizationConsentAuthenticationProvider
(RegisteredClientRepository registeredClientRepository, OAuth2AuthorizationService authorizationService, OAuth2AuthorizationConsentService authorizationConsentService) Constructs anOAuth2AuthorizationConsentAuthenticationProvider
using the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authentication
authenticate
(org.springframework.security.core.Authentication authentication) void
setAuthorizationCodeGenerator
(OAuth2TokenGenerator<OAuth2AuthorizationCode> authorizationCodeGenerator) Sets theOAuth2TokenGenerator
that generates theOAuth2AuthorizationCode
.void
setAuthorizationConsentCustomizer
(Consumer<OAuth2AuthorizationConsentAuthenticationContext> authorizationConsentCustomizer) Sets theConsumer
providing access to theOAuth2AuthorizationConsentAuthenticationContext
containing anOAuth2AuthorizationConsent.Builder
and additional context information.boolean
-
Constructor Details
-
OAuth2AuthorizationConsentAuthenticationProvider
public OAuth2AuthorizationConsentAuthenticationProvider(RegisteredClientRepository registeredClientRepository, OAuth2AuthorizationService authorizationService, OAuth2AuthorizationConsentService authorizationConsentService) Constructs anOAuth2AuthorizationConsentAuthenticationProvider
using the provided parameters.- Parameters:
registeredClientRepository
- the repository of registered clientsauthorizationService
- the authorization serviceauthorizationConsentService
- the authorization consent service
-
-
Method Details
-
authenticate
public org.springframework.security.core.Authentication authenticate(org.springframework.security.core.Authentication authentication) throws org.springframework.security.core.AuthenticationException - Specified by:
authenticate
in interfaceorg.springframework.security.authentication.AuthenticationProvider
- Throws:
org.springframework.security.core.AuthenticationException
-
supports
- Specified by:
supports
in interfaceorg.springframework.security.authentication.AuthenticationProvider
-
setAuthorizationCodeGenerator
public void setAuthorizationCodeGenerator(OAuth2TokenGenerator<OAuth2AuthorizationCode> authorizationCodeGenerator) Sets theOAuth2TokenGenerator
that generates theOAuth2AuthorizationCode
.- Parameters:
authorizationCodeGenerator
- theOAuth2TokenGenerator
that generates theOAuth2AuthorizationCode
-
setAuthorizationConsentCustomizer
public void setAuthorizationConsentCustomizer(Consumer<OAuth2AuthorizationConsentAuthenticationContext> authorizationConsentCustomizer) Sets theConsumer
providing access to theOAuth2AuthorizationConsentAuthenticationContext
containing anOAuth2AuthorizationConsent.Builder
and additional context information.The following context attributes are available:
- The
OAuth2AuthorizationConsent.Builder
used to build the authorization consent prior toOAuth2AuthorizationConsentService.save(OAuth2AuthorizationConsent)
. - The
Authentication
of typeOAuth2AuthorizationConsentAuthenticationToken
. - The
RegisteredClient
associated with the authorization request. - The
OAuth2Authorization
associated with the state token presented in the authorization consent request. - The
OAuth2AuthorizationRequest
associated with the authorization consent request.
- Parameters:
authorizationConsentCustomizer
- theConsumer
providing access to theOAuth2AuthorizationConsentAuthenticationContext
containing anOAuth2AuthorizationConsent.Builder
- The
-