org.springframework.security.oauth2.provider
Class AuthorizationRequest

java.lang.Object
  extended by org.springframework.security.oauth2.provider.AuthorizationRequest
All Implemented Interfaces:
Serializable

public class AuthorizationRequest
extends Object
implements Serializable

A request for authorization by an OAuth 2 Client, normally received and processed by the AuthorizationEndpoint. This class is meant to be manipulated throughout the authorization process, and is therefore treated as ephemeral and not to be stored long term. For long term storage, use the read-only OAuth2Request class. HTTP request parameters are stored in the parameters map, and any processing the server makes throughout the lifecycle of a request are stored on individual properties. The original request parameters will remain available through the parameters map. For convenience, constants are defined in order to get at those original values. However, the parameters map is unmodifiable so that processing cannot drop the original values. This class is Serializable in order to support storage of the authorization request as a SessionAttributes member while the end user through the authorization process (which may span several page requests).

Author:
Ryan Heaton, Dave Syer, Amanda Anganes
See Also:
Serialized Form

Constructor Summary
AuthorizationRequest()
          Default constructor.
AuthorizationRequest(Map<String,String> authorizationParameters, Map<String,String> approvalParameters, String clientId, Set<String> scope, Set<String> resourceIds, Collection<? extends org.springframework.security.core.GrantedAuthority> authorities, boolean approved, String state, String redirectUri, Set<String> responseTypes)
          Full constructor.
AuthorizationRequest(String clientId, Collection<String> scopes)
          Convenience constructor for unit tests, where client ID and scope are often the only needed fields.
 
Method Summary
 OAuth2Request createOAuth2Request()
           
 boolean equals(Object obj)
           
 Map<String,String> getApprovalParameters()
           
 Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities()
           
 String getClientId()
           
 Map<String,Serializable> getExtensions()
           
 String getRedirectUri()
           
 Map<String,String> getRequestParameters()
          Warning: most clients should use the individual properties of this class, such as {getScope() or { getClientId(), rather than retrieving values from this map.
 Set<String> getResourceIds()
           
 Set<String> getResponseTypes()
           
 Set<String> getScope()
           
 String getState()
           
 int hashCode()
           
 boolean isApproved()
           
 void setApprovalParameters(Map<String,String> approvalParameters)
           
 void setApproved(boolean approved)
           
 void setAuthorities(Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)
           
 void setClientId(String clientId)
           
 void setExtensions(Map<String,Serializable> extensions)
           
 void setRedirectUri(String redirectUri)
           
 void setRequestParameters(Map<String,String> requestParameters)
          Set the Request Parameters on this authorization request, which represent the original request parameters and should never be changed during processing.
 void setResourceIds(Set<String> resourceIds)
           
 void setResourceIdsAndAuthoritiesFromClientDetails(ClientDetails clientDetails)
          Convenience method to set resourceIds and authorities on this request by inheriting from a ClientDetails object.
 void setResponseTypes(Set<String> responseTypes)
           
 void setScope(Collection<String> scope)
          Set the scope value.
 void setState(String state)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthorizationRequest

public AuthorizationRequest()
Default constructor.


AuthorizationRequest

public AuthorizationRequest(Map<String,String> authorizationParameters,
                            Map<String,String> approvalParameters,
                            String clientId,
                            Set<String> scope,
                            Set<String> resourceIds,
                            Collection<? extends org.springframework.security.core.GrantedAuthority> authorities,
                            boolean approved,
                            String state,
                            String redirectUri,
                            Set<String> responseTypes)
Full constructor.


AuthorizationRequest

public AuthorizationRequest(String clientId,
                            Collection<String> scopes)
Convenience constructor for unit tests, where client ID and scope are often the only needed fields.

Parameters:
clientId -
scopes -
Method Detail

createOAuth2Request

public OAuth2Request createOAuth2Request()

setResourceIdsAndAuthoritiesFromClientDetails

public void setResourceIdsAndAuthoritiesFromClientDetails(ClientDetails clientDetails)
Convenience method to set resourceIds and authorities on this request by inheriting from a ClientDetails object.

Parameters:
clientDetails -

getApprovalParameters

public Map<String,String> getApprovalParameters()

setApprovalParameters

public void setApprovalParameters(Map<String,String> approvalParameters)

getState

public String getState()

setState

public void setState(String state)

getResponseTypes

public Set<String> getResponseTypes()

setResponseTypes

public void setResponseTypes(Set<String> responseTypes)

setRedirectUri

public void setRedirectUri(String redirectUri)

setApproved

public void setApproved(boolean approved)

setAuthorities

public void setAuthorities(Collection<? extends org.springframework.security.core.GrantedAuthority> authorities)

getExtensions

public Map<String,Serializable> getExtensions()
Returns:
the extensions

setExtensions

public void setExtensions(Map<String,Serializable> extensions)

setResourceIds

public void setResourceIds(Set<String> resourceIds)

setClientId

public void setClientId(String clientId)

setScope

public void setScope(Collection<String> scope)
Set the scope value. If the collection contains only a single scope value, this method will parse that value into a collection using OAuth2Utils.parseParameterList.

Parameters:
scope -
See Also:
TokenRequest.setScope

setRequestParameters

public void setRequestParameters(Map<String,String> requestParameters)
Set the Request Parameters on this authorization request, which represent the original request parameters and should never be changed during processing. The map passed in is wrapped in an unmodifiable map instance.

Parameters:
requestParameters -
See Also:
TokenRequest.setRequestParameters

getResourceIds

public Set<String> getResourceIds()
Returns:
the resourceIds

getAuthorities

public Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities()
Returns:
the authorities

isApproved

public boolean isApproved()
Returns:
the approved

getRedirectUri

public String getRedirectUri()
Returns:
the redirectUri

hashCode

public int hashCode()

equals

public boolean equals(Object obj)

getClientId

public String getClientId()

getScope

public Set<String> getScope()

getRequestParameters

public Map<String,String> getRequestParameters()
Warning: most clients should use the individual properties of this class, such as {getScope() or { getClientId(), rather than retrieving values from this map.

Returns:
the original, unchanged set of request parameters


Copyright © 2013. All rights reserved.