public class DefaultOAuth2RequestFactory extends Object implements OAuth2RequestFactory
OAuth2RequestFactory
which initializes fields from the parameters map, validates
grant types and scopes, and fills in scopes with the default values from the client if they are missing.Constructor and Description |
---|
DefaultOAuth2RequestFactory(ClientDetailsService clientDetailsService) |
Modifier and Type | Method and Description |
---|---|
AuthorizationRequest |
createAuthorizationRequest(Map<String,String> authorizationParameters)
Create a new
AuthorizationRequest extracting all the needed information from the incoming parameter map,
and initializing all individual fields on the AuthorizationRequest to reasonable values. |
OAuth2Request |
createOAuth2Request(AuthorizationRequest request)
Create a new
OAuth2Request by extracting the needed information from the current
AuthorizationRequest object. |
OAuth2Request |
createOAuth2Request(ClientDetails client,
TokenRequest tokenRequest)
Create a new
OAuth2Request by extracting the needed information from the current TokenRequest
object. |
TokenRequest |
createTokenRequest(AuthorizationRequest authorizationRequest,
String grantType)
Create a new
TokenRequest from an AuthorizationRequest . |
TokenRequest |
createTokenRequest(Map<String,String> requestParameters,
ClientDetails authenticatedClient)
Create a new
TokenRequest by extracting the needed information from the incoming request parameter map. |
void |
setCheckUserScopes(boolean checkUserScopes)
Flag to indicate that scopes should be interpreted as valid authorities.
|
void |
setSecurityContextAccessor(SecurityContextAccessor securityContextAccessor) |
public DefaultOAuth2RequestFactory(ClientDetailsService clientDetailsService)
public void setSecurityContextAccessor(SecurityContextAccessor securityContextAccessor)
securityContextAccessor
- the security context accessor to setpublic void setCheckUserScopes(boolean checkUserScopes)
checkUserScopes
- the checkUserScopes to set (default false)public AuthorizationRequest createAuthorizationRequest(Map<String,String> authorizationParameters)
OAuth2RequestFactory
AuthorizationRequest
extracting all the needed information from the incoming parameter map,
and initializing all individual fields on the AuthorizationRequest
to reasonable values. When a class
uses the factory to create an AuthorizationRequest
, it should not need to access the parameter map
directly afterwards.
Typical implementations would initialize the individual fields on the AuthorizationRequest
with the
values requested in the original parameter map. It may also load the client details from the client id provided
and validate the grant type and scopes, populating any fields in the request that are known only to the
authorization server.createAuthorizationRequest
in interface OAuth2RequestFactory
authorizationParameters
- the parameters in the requestpublic OAuth2Request createOAuth2Request(AuthorizationRequest request)
OAuth2RequestFactory
OAuth2Request
by extracting the needed information from the current
AuthorizationRequest
object.createOAuth2Request
in interface OAuth2RequestFactory
request
- the request to be convertedpublic TokenRequest createTokenRequest(Map<String,String> requestParameters, ClientDetails authenticatedClient)
OAuth2RequestFactory
TokenRequest
by extracting the needed information from the incoming request parameter map.createTokenRequest
in interface OAuth2RequestFactory
requestParameters
- the parameters in the requestauthenticatedClient
- the client that authenticated during the token requestpublic TokenRequest createTokenRequest(AuthorizationRequest authorizationRequest, String grantType)
OAuth2RequestFactory
TokenRequest
from an AuthorizationRequest
. Principally used by the
AuthorizationEndpoint during the implicit flow.createTokenRequest
in interface OAuth2RequestFactory
authorizationRequest
- the incoming requestgrantType
- the grant type for the token requestpublic OAuth2Request createOAuth2Request(ClientDetails client, TokenRequest tokenRequest)
OAuth2RequestFactory
OAuth2Request
by extracting the needed information from the current TokenRequest
object.createOAuth2Request
in interface OAuth2RequestFactory
client
- TODOtokenRequest
- the request to be convertedCopyright © 2019. All rights reserved.