public class TokenStoreUserApprovalHandler extends Object implements UserApprovalHandler, InitializingBean
Constructor and Description |
---|
TokenStoreUserApprovalHandler() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
AuthorizationRequest |
checkForPreApproval(AuthorizationRequest authorizationRequest,
org.springframework.security.core.Authentication userAuthentication)
Provides a hook for allowing requests to be pre-approved (skipping the User
Approval Page).
|
Map<String,Object> |
getUserApprovalRequest(AuthorizationRequest authorizationRequest,
org.springframework.security.core.Authentication userAuthentication)
Generate a request for the authorization server to ask for the user's approval.
|
boolean |
isApproved(AuthorizationRequest authorizationRequest,
org.springframework.security.core.Authentication userAuthentication)
Basic implementation just requires the authorization request to be explicitly approved and the user to be
authenticated.
|
void |
setApprovalParameter(String approvalParameter) |
void |
setClientDetailsService(ClientDetailsService clientDetailsService)
Service to load client details (optional) for auto approval checks.
|
void |
setRequestFactory(OAuth2RequestFactory requestFactory) |
void |
setTokenStore(TokenStore tokenStore) |
AuthorizationRequest |
updateAfterApproval(AuthorizationRequest authorizationRequest,
org.springframework.security.core.Authentication userAuthentication)
Provides an opportunity to update the authorization request after the
approval parameters are set
but before it is checked for approval. |
public void setClientDetailsService(ClientDetailsService clientDetailsService)
clientDetailsService
- a client details servicepublic void setApprovalParameter(String approvalParameter)
approvalParameter
- the approvalParameter to setpublic void setTokenStore(TokenStore tokenStore)
tokenStore
- the token store to setpublic void setRequestFactory(OAuth2RequestFactory requestFactory)
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
public boolean isApproved(AuthorizationRequest authorizationRequest, org.springframework.security.core.Authentication userAuthentication)
isApproved
in interface UserApprovalHandler
authorizationRequest
- The authorization request.userAuthentication
- the current user authenticationpublic AuthorizationRequest checkForPreApproval(AuthorizationRequest authorizationRequest, org.springframework.security.core.Authentication userAuthentication)
UserApprovalHandler
Provides a hook for allowing requests to be pre-approved (skipping the User Approval Page). Some implementations may allow users to store approval decisions so that they only have to approve a site once. This method is called in the AuthorizationEndpoint before sending the user to the Approval page. If this method sets oAuth2Request.approved to true, the Approval page will be skipped.
checkForPreApproval
in interface UserApprovalHandler
authorizationRequest
- the authorization request.userAuthentication
- the user authenticationpublic AuthorizationRequest updateAfterApproval(AuthorizationRequest authorizationRequest, org.springframework.security.core.Authentication userAuthentication)
UserApprovalHandler
Provides an opportunity to update the authorization request after the
approval parameters
are set
but before it is checked for approval. Useful in cases where the incoming approval
parameters contain richer information than just true/false (e.g. some scopes are
approved, and others are rejected), implementations may need to be able to modify
the AuthorizationRequest
before a token is generated from it.
updateAfterApproval
in interface UserApprovalHandler
authorizationRequest
- the authorization request.userAuthentication
- the user authenticationpublic Map<String,Object> getUserApprovalRequest(AuthorizationRequest authorizationRequest, org.springframework.security.core.Authentication userAuthentication)
UserApprovalHandler
getUserApprovalRequest
in interface UserApprovalHandler
authorizationRequest
- the authorization requestuserAuthentication
- the user authenticationCopyright © 2019. All rights reserved.