Class DefaultServerOAuth2AuthorizationRequestResolver
- java.lang.Object
-
- org.springframework.security.oauth2.client.web.server.DefaultServerOAuth2AuthorizationRequestResolver
-
- All Implemented Interfaces:
ServerOAuth2AuthorizationRequestResolver
public class DefaultServerOAuth2AuthorizationRequestResolver extends java.lang.Object implements ServerOAuth2AuthorizationRequestResolver
The default implementation ofServerOAuth2AuthorizationRequestResolver. TheClientRegistration.getRegistrationId()is extracted from the request using theDEFAULT_AUTHORIZATION_REQUEST_PATTERN. The injectedReactiveClientRegistrationRepositoryis then used to resolve theClientRegistrationand create theOAuth2AuthorizationRequest.- Since:
- 5.1
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_AUTHORIZATION_REQUEST_PATTERNThe default pattern used to resolve theClientRegistration.getRegistrationId()static java.lang.StringDEFAULT_REGISTRATION_ID_URI_VARIABLE_NAMEThe name of the path variable that contains theClientRegistration.getRegistrationId()
-
Constructor Summary
Constructors Constructor Description DefaultServerOAuth2AuthorizationRequestResolver(ReactiveClientRegistrationRepository clientRegistrationRepository)Creates a new instanceDefaultServerOAuth2AuthorizationRequestResolver(ReactiveClientRegistrationRepository clientRegistrationRepository, org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher authorizationRequestMatcher)Creates a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest>resolve(org.springframework.web.server.ServerWebExchange exchange)Returns theOAuth2AuthorizationRequestresolved from the providedHttpServletRequestornullif not available.reactor.core.publisher.Mono<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest>resolve(org.springframework.web.server.ServerWebExchange exchange, java.lang.String clientRegistrationId)Returns theOAuth2AuthorizationRequestresolved from the providedHttpServletRequestornullif not available.voidsetAuthorizationRequestCustomizer(java.util.function.Consumer<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest.Builder> authorizationRequestCustomizer)Sets theConsumerto be provided theOAuth2AuthorizationRequest.Builderallowing for further customizations.
-
-
-
Field Detail
-
DEFAULT_REGISTRATION_ID_URI_VARIABLE_NAME
public static final java.lang.String DEFAULT_REGISTRATION_ID_URI_VARIABLE_NAME
The name of the path variable that contains theClientRegistration.getRegistrationId()- See Also:
- Constant Field Values
-
DEFAULT_AUTHORIZATION_REQUEST_PATTERN
public static final java.lang.String DEFAULT_AUTHORIZATION_REQUEST_PATTERN
The default pattern used to resolve theClientRegistration.getRegistrationId()- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultServerOAuth2AuthorizationRequestResolver
public DefaultServerOAuth2AuthorizationRequestResolver(ReactiveClientRegistrationRepository clientRegistrationRepository)
Creates a new instance- Parameters:
clientRegistrationRepository- the repository to resolve theClientRegistration
-
DefaultServerOAuth2AuthorizationRequestResolver
public DefaultServerOAuth2AuthorizationRequestResolver(ReactiveClientRegistrationRepository clientRegistrationRepository, org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher authorizationRequestMatcher)
Creates a new instance- Parameters:
clientRegistrationRepository- the repository to resolve theClientRegistrationauthorizationRequestMatcher- the matcher that determines if the request is a match and extracts theDEFAULT_REGISTRATION_ID_URI_VARIABLE_NAMEfrom the path variables.
-
-
Method Detail
-
resolve
public reactor.core.publisher.Mono<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest> resolve(org.springframework.web.server.ServerWebExchange exchange)
Description copied from interface:ServerOAuth2AuthorizationRequestResolverReturns theOAuth2AuthorizationRequestresolved from the providedHttpServletRequestornullif not available.- Specified by:
resolvein interfaceServerOAuth2AuthorizationRequestResolver- Parameters:
exchange- theServerWebExchange- Returns:
- the resolved
OAuth2AuthorizationRequestornullif not available
-
resolve
public reactor.core.publisher.Mono<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest> resolve(org.springframework.web.server.ServerWebExchange exchange, java.lang.String clientRegistrationId)Description copied from interface:ServerOAuth2AuthorizationRequestResolverReturns theOAuth2AuthorizationRequestresolved from the providedHttpServletRequestornullif not available.- Specified by:
resolvein interfaceServerOAuth2AuthorizationRequestResolver- Parameters:
exchange- theServerWebExchangeclientRegistrationId- the client registration id- Returns:
- the resolved
OAuth2AuthorizationRequestornullif not available
-
setAuthorizationRequestCustomizer
public final void setAuthorizationRequestCustomizer(java.util.function.Consumer<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest.Builder> authorizationRequestCustomizer)
Sets theConsumerto be provided theOAuth2AuthorizationRequest.Builderallowing for further customizations.- Parameters:
authorizationRequestCustomizer- theConsumerto be provided theOAuth2AuthorizationRequest.Builder- Since:
- 5.3
-
-