Class DefaultServerOAuth2AuthorizationRequestResolver
java.lang.Object
org.springframework.security.oauth2.client.web.server.DefaultServerOAuth2AuthorizationRequestResolver
- All Implemented Interfaces:
ServerOAuth2AuthorizationRequestResolver
public class DefaultServerOAuth2AuthorizationRequestResolver
extends Object
implements ServerOAuth2AuthorizationRequestResolver
The default implementation of
ServerOAuth2AuthorizationRequestResolver
.
The ClientRegistration.getRegistrationId()
is extracted from the request using
the DEFAULT_AUTHORIZATION_REQUEST_PATTERN
. The injected
ReactiveClientRegistrationRepository
is then used to resolve the
ClientRegistration
and create the OAuth2AuthorizationRequest
.- Since:
- 5.1
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The default pattern used to resolve theClientRegistration.getRegistrationId()
static final String
The name of the path variable that contains theClientRegistration.getRegistrationId()
-
Constructor Summary
ConstructorDescriptionDefaultServerOAuth2AuthorizationRequestResolver
(ReactiveClientRegistrationRepository clientRegistrationRepository) Creates a new instanceDefaultServerOAuth2AuthorizationRequestResolver
(ReactiveClientRegistrationRepository clientRegistrationRepository, ServerWebExchangeMatcher authorizationRequestMatcher) Creates a new instance -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<OAuth2AuthorizationRequest>
resolve
(org.springframework.web.server.ServerWebExchange exchange) Returns theOAuth2AuthorizationRequest
resolved from the providedHttpServletRequest
ornull
if not available.reactor.core.publisher.Mono<OAuth2AuthorizationRequest>
Returns theOAuth2AuthorizationRequest
resolved from the providedHttpServletRequest
ornull
if not available.final void
setAuthorizationRequestCustomizer
(Consumer<OAuth2AuthorizationRequest.Builder> authorizationRequestCustomizer) Sets theConsumer
to be provided theOAuth2AuthorizationRequest.Builder
allowing for further customizations.
-
Field Details
-
DEFAULT_REGISTRATION_ID_URI_VARIABLE_NAME
The name of the path variable that contains theClientRegistration.getRegistrationId()
- See Also:
-
DEFAULT_AUTHORIZATION_REQUEST_PATTERN
The default pattern used to resolve theClientRegistration.getRegistrationId()
- See Also:
-
-
Constructor Details
-
DefaultServerOAuth2AuthorizationRequestResolver
public DefaultServerOAuth2AuthorizationRequestResolver(ReactiveClientRegistrationRepository clientRegistrationRepository) Creates a new instance- Parameters:
clientRegistrationRepository
- the repository to resolve theClientRegistration
-
DefaultServerOAuth2AuthorizationRequestResolver
public DefaultServerOAuth2AuthorizationRequestResolver(ReactiveClientRegistrationRepository clientRegistrationRepository, ServerWebExchangeMatcher authorizationRequestMatcher) Creates a new instance- Parameters:
clientRegistrationRepository
- the repository to resolve theClientRegistration
authorizationRequestMatcher
- the matcher that determines if the request is a match and extracts theDEFAULT_REGISTRATION_ID_URI_VARIABLE_NAME
from the path variables.
-
-
Method Details
-
resolve
public reactor.core.publisher.Mono<OAuth2AuthorizationRequest> resolve(org.springframework.web.server.ServerWebExchange exchange) Description copied from interface:ServerOAuth2AuthorizationRequestResolver
Returns theOAuth2AuthorizationRequest
resolved from the providedHttpServletRequest
ornull
if not available.- Specified by:
resolve
in interfaceServerOAuth2AuthorizationRequestResolver
- Parameters:
exchange
- theServerWebExchange
- Returns:
- the resolved
OAuth2AuthorizationRequest
ornull
if not available
-
resolve
public reactor.core.publisher.Mono<OAuth2AuthorizationRequest> resolve(org.springframework.web.server.ServerWebExchange exchange, String clientRegistrationId) Description copied from interface:ServerOAuth2AuthorizationRequestResolver
Returns theOAuth2AuthorizationRequest
resolved from the providedHttpServletRequest
ornull
if not available.- Specified by:
resolve
in interfaceServerOAuth2AuthorizationRequestResolver
- Parameters:
exchange
- theServerWebExchange
clientRegistrationId
- the client registration id- Returns:
- the resolved
OAuth2AuthorizationRequest
ornull
if not available
-
setAuthorizationRequestCustomizer
public final void setAuthorizationRequestCustomizer(Consumer<OAuth2AuthorizationRequest.Builder> authorizationRequestCustomizer) Sets theConsumer
to be provided theOAuth2AuthorizationRequest.Builder
allowing for further customizations.- Parameters:
authorizationRequestCustomizer
- theConsumer
to be provided theOAuth2AuthorizationRequest.Builder
- Since:
- 5.3
- See Also:
-