Class OAuth2AuthorizationCodeRequestAuthenticationProvider
java.lang.Object
org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeRequestAuthenticationProvider
- All Implemented Interfaces:
org.springframework.security.authentication.AuthenticationProvider
public final class OAuth2AuthorizationCodeRequestAuthenticationProvider
extends Object
implements org.springframework.security.authentication.AuthenticationProvider
An
AuthenticationProvider
implementation for the OAuth 2.0 Authorization Request
used in the Authorization Code Grant.- Since:
- 0.1.2
- See Also:
-
OAuth2AuthorizationCodeRequestAuthenticationToken
OAuth2AuthorizationCodeRequestAuthenticationValidator
OAuth2AuthorizationCodeAuthenticationProvider
OAuth2AuthorizationConsentAuthenticationProvider
RegisteredClientRepository
OAuth2AuthorizationService
OAuth2AuthorizationConsentService
- Section 4.1.1 Authorization Request
-
Constructor Summary
ConstructorDescriptionOAuth2AuthorizationCodeRequestAuthenticationProvider
(RegisteredClientRepository registeredClientRepository, OAuth2AuthorizationService authorizationService, OAuth2AuthorizationConsentService authorizationConsentService) Constructs anOAuth2AuthorizationCodeRequestAuthenticationProvider
using the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authentication
authenticate
(org.springframework.security.core.Authentication authentication) void
setAuthenticationValidator
(Consumer<OAuth2AuthorizationCodeRequestAuthenticationContext> authenticationValidator) Sets theConsumer
providing access to theOAuth2AuthorizationCodeRequestAuthenticationContext
and is responsible for validating specific OAuth 2.0 Authorization Request parameters associated in theOAuth2AuthorizationCodeRequestAuthenticationToken
.void
setAuthorizationCodeGenerator
(OAuth2TokenGenerator<OAuth2AuthorizationCode> authorizationCodeGenerator) Sets theOAuth2TokenGenerator
that generates theOAuth2AuthorizationCode
.boolean
-
Constructor Details
-
OAuth2AuthorizationCodeRequestAuthenticationProvider
public OAuth2AuthorizationCodeRequestAuthenticationProvider(RegisteredClientRepository registeredClientRepository, OAuth2AuthorizationService authorizationService, OAuth2AuthorizationConsentService authorizationConsentService) Constructs anOAuth2AuthorizationCodeRequestAuthenticationProvider
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
- Since:
- 0.2.3
-
setAuthenticationValidator
public void setAuthenticationValidator(Consumer<OAuth2AuthorizationCodeRequestAuthenticationContext> authenticationValidator) Sets theConsumer
providing access to theOAuth2AuthorizationCodeRequestAuthenticationContext
and is responsible for validating specific OAuth 2.0 Authorization Request parameters associated in theOAuth2AuthorizationCodeRequestAuthenticationToken
. The default authentication validator isOAuth2AuthorizationCodeRequestAuthenticationValidator
.NOTE: The authentication validator MUST throw
OAuth2AuthorizationCodeRequestAuthenticationException
if validation fails.- Parameters:
authenticationValidator
- theConsumer
providing access to theOAuth2AuthorizationCodeRequestAuthenticationContext
and is responsible for validating specific OAuth 2.0 Authorization Request parameters- Since:
- 0.4.0
-