public class BroadleafAuthorizationRequestRepository extends Object implements org.springframework.security.oauth2.client.web.AuthorizationRequestRepository<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest>
OAuth2AuthorizationRequest
from a cookie.
The OAuth2AuthorizationRequest
is wrapped in an AuthorizationRequestWrapper
. Then
it is serialized, wrapped in a signed jwt token, and saved to a cookie. When the browser
redirects back to this app from the third party login, the AuthorizationRequestWrapper
is
read from the cookie, verified, and deserialized into an OAuth2AuthorizationRequest
.Modifier and Type | Field and Description |
---|---|
protected static String |
AUTH_REQUEST_CLAIM_KEY |
protected static long |
EXPIRES_IN_SECONDS |
protected static String |
SAVED_AUTH_REQUEST_COOKIE_NAME |
Constructor and Description |
---|
BroadleafAuthorizationRequestRepository(StatelessUtil statelessUtil,
ContextHelperService contextHelperService) |
Modifier and Type | Method and Description |
---|---|
protected org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest |
buildOAuth2AuthorizationRequest(AuthorizationRequestWrapper authorizationRequestWrapper)
Build a
OAuth2AuthorizationRequest from a AuthorizationRequestWrapper . |
protected AuthorizationRequestWrapper |
deserializeCookie(String cookie)
Deserialize a cookie value into an
AuthorizationRequestWrapper . |
protected ContextHelperService |
getContextHelperService() |
protected com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper() |
protected AuthorizationRequestRepositoryProperties |
getProperties() |
@NotNull String |
getSavedAuthRequestCookieName() |
protected StatelessUtil |
getStatelessUtil() |
org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest |
loadAuthorizationRequest(javax.servlet.http.HttpServletRequest request)
Load a saved
OAuth2AuthorizationRequest from a cookie. |
protected AuthorizationRequestWrapper |
readAuthRequestWrapperFromCookie(javax.servlet.http.HttpServletRequest request) |
org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest |
removeAuthorizationRequest(javax.servlet.http.HttpServletRequest request)
This method is deprecated in the interface and is not supported by this implementation.
|
org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest |
removeAuthorizationRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Set a blank cookie to delete the saved authorization request.
|
void |
saveAuthorizationRequest(org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest authorizationRequest,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Save a
OAuth2AuthorizationRequest to a cookie. |
protected @NotNull javax.servlet.http.Cookie |
saveAuthRequestWrapper(AuthorizationRequestWrapper authorizationRequestWrapper)
Deprecated.
since 1.6, replaced by
saveAuthRequestWrapperResponseCookie(AuthorizationRequestWrapper) |
protected @NotNull org.springframework.http.ResponseCookie |
saveAuthRequestWrapperResponseCookie(AuthorizationRequestWrapper authorizationRequestWrapper) |
protected String |
serializeAuthRequest(AuthorizationRequestWrapper authorizationRequestWrapper)
Serialize the given
AuthorizationRequestWrapper into a String. |
protected void |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
void |
setProperties(AuthorizationRequestRepositoryProperties properties) |
protected AuthorizationRequestWrapper |
wrapAuthorizationRequest(org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest authorizationRequest,
String clientId)
Wrap a
OAuth2AuthorizationRequest in a AuthorizationRequestWrapper with the
current client id |
protected AuthorizationRequestWrapper |
wrapAuthRequest(org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest authorizationRequest)
Wrap the given
OAuth2AuthorizationRequest into an AuthorizationRequestWrapper
The AuthorizationRequestWrapper includes a blcClientId field, which is set from a
request parameter. |
protected static final String SAVED_AUTH_REQUEST_COOKIE_NAME
protected static final String AUTH_REQUEST_CLAIM_KEY
protected static final long EXPIRES_IN_SECONDS
public BroadleafAuthorizationRequestRepository(StatelessUtil statelessUtil, ContextHelperService contextHelperService)
@Nullable public org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest loadAuthorizationRequest(javax.servlet.http.HttpServletRequest request)
OAuth2AuthorizationRequest
from a cookie. As a side-effect, this method
will also set the clientId as a request attribute.loadAuthorizationRequest
in interface org.springframework.security.oauth2.client.web.AuthorizationRequestRepository<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest>
request
- public void saveAuthorizationRequest(org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest authorizationRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
OAuth2AuthorizationRequest
to a cookie.saveAuthorizationRequest
in interface org.springframework.security.oauth2.client.web.AuthorizationRequestRepository<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest>
authorizationRequest
- request
- response
- public org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest removeAuthorizationRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
removeAuthorizationRequest
in interface org.springframework.security.oauth2.client.web.AuthorizationRequestRepository<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest>
request
- response
- public org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest removeAuthorizationRequest(javax.servlet.http.HttpServletRequest request)
removeAuthorizationRequest
in interface org.springframework.security.oauth2.client.web.AuthorizationRequestRepository<org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest>
request
- UnsupportedOperationException
@NotNull @Deprecated protected @NotNull javax.servlet.http.Cookie saveAuthRequestWrapper(AuthorizationRequestWrapper authorizationRequestWrapper)
saveAuthRequestWrapperResponseCookie(AuthorizationRequestWrapper)
authorizationRequestWrapper
- the authorization request wrapper to create a cookie for@NotNull protected @NotNull org.springframework.http.ResponseCookie saveAuthRequestWrapperResponseCookie(AuthorizationRequestWrapper authorizationRequestWrapper)
protected String serializeAuthRequest(AuthorizationRequestWrapper authorizationRequestWrapper)
AuthorizationRequestWrapper
into a String.authorizationRequestWrapper
- @Nullable protected AuthorizationRequestWrapper readAuthRequestWrapperFromCookie(javax.servlet.http.HttpServletRequest request)
protected AuthorizationRequestWrapper deserializeCookie(String cookie)
AuthorizationRequestWrapper
.cookie
- protected AuthorizationRequestWrapper wrapAuthRequest(org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest authorizationRequest)
OAuth2AuthorizationRequest
into an AuthorizationRequestWrapper
The AuthorizationRequestWrapper
includes a blcClientId field, which is set from a
request parameter.authorizationRequest
- protected AuthorizationRequestWrapper wrapAuthorizationRequest(org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest authorizationRequest, String clientId)
OAuth2AuthorizationRequest
in a AuthorizationRequestWrapper
with the
current client idauthorizationRequest
- clientId
- protected org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest buildOAuth2AuthorizationRequest(AuthorizationRequestWrapper authorizationRequestWrapper)
OAuth2AuthorizationRequest
from a AuthorizationRequestWrapper
.authorizationRequestWrapper
- @NotNull public @NotNull String getSavedAuthRequestCookieName()
protected StatelessUtil getStatelessUtil()
protected ContextHelperService getContextHelperService()
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
protected void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected AuthorizationRequestRepositoryProperties getProperties()
@Autowired public void setProperties(AuthorizationRequestRepositoryProperties properties)
Copyright © 2021. All rights reserved.