public class ApprovalStoreUserApprovalHandler extends Object implements UserApprovalHandler, InitializingBean
Constructor and Description |
---|
ApprovalStoreUserApprovalHandler() |
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)
Tests whether the specified authorization request has been approved by the current
user (if there is one).
|
void |
setApprovalExpiryInSeconds(int approvalExpirySeconds) |
void |
setApprovalStore(ApprovalStore store) |
void |
setClientDetailsService(ClientDetailsService clientDetailsService)
Service to load client details (optional) for auto approval checks.
|
void |
setRequestFactory(OAuth2RequestFactory requestFactory) |
void |
setScopePrefix(String scopePrefix)
The prefix applied to incoming parameters that signal approval or denial of a scope.
|
AuthorizationRequest |
updateAfterApproval(AuthorizationRequest authorizationRequest,
org.springframework.security.core.Authentication userAuthentication)
Requires the authorization request to be explicitly approved, including all individual scopes, and the user to be
authenticated.
|
public void setClientDetailsService(ClientDetailsService clientDetailsService)
clientDetailsService
- a client details servicepublic void setScopePrefix(String scopePrefix)
scopePrefix
- the prefix (default OAuth2Utils.SCOPE_PREFIX
)public void setApprovalStore(ApprovalStore store)
store
- the approval to setpublic void setRequestFactory(OAuth2RequestFactory requestFactory)
public void setApprovalExpiryInSeconds(int approvalExpirySeconds)
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
public boolean isApproved(AuthorizationRequest authorizationRequest, org.springframework.security.core.Authentication userAuthentication)
UserApprovalHandler
Tests whether the specified authorization request has been approved by the current user (if there is one).
isApproved
in interface UserApprovalHandler
authorizationRequest
- the authorization request.userAuthentication
- the user authentication for the current user.public 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)
scope.<scopename>
equal to "true" or "approved" (otherwise it will be assumed to
have been denied). The ApprovalStore
will be updated to reflect the inputs.updateAfterApproval
in interface UserApprovalHandler
authorizationRequest
- The authorization request.userAuthentication
- the current 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.