|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nimbusds.oauth2.sdk.AuthorizationRequest
@Immutable public class AuthorizationRequest
Authorisation request. Used to authenticate an end-user and request the end-user's consent to grant the client access to a protected resource. This class is immutable.
Extending classes may define additional parameters as well as enforce tighter requirements on the base parameters.
Example HTTP request:
https://server.example.com/authorize? response_type=code &client_id=s6BhdRkqt3 &state=xyz &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
Related specifications:
Constructor Summary | |
---|---|
AuthorizationRequest(ResponseTypeSet rts,
ClientID clientID)
Creates a new minimal authorisation request. |
|
AuthorizationRequest(ResponseTypeSet rts,
ClientID clientID,
URL redirectURI,
Scope scope,
State state)
Creates a new authorisation request. |
Method Summary | |
---|---|
ClientID |
getClientID()
Gets the client identifier. |
URL |
getRedirectURI()
Gets the redirection URI. |
ResponseTypeSet |
getResponseTypeSet()
Gets the response type set. |
Scope |
getScope()
Gets the scope. |
State |
getState()
Gets the state. |
static AuthorizationRequest |
parse(HTTPRequest httpRequest)
Parses an authorisation request from the specified HTTP request. |
static AuthorizationRequest |
parse(Map<String,String> params)
Parses an authorisation request from the specified parameters. |
static AuthorizationRequest |
parse(String query)
Parses an authorisation request from the specified URL query string. |
HTTPRequest |
toHTTPRequest(URL url)
Returns the matching HTTP request. |
HTTPRequest |
toHTTPRequest(URL url,
HTTPRequest.Method method)
Returns the matching HTTP request. |
Map<String,String> |
toParameters()
Returns the parameters for this authorisation request. |
String |
toQueryString()
Returns the URL query string for this authorisation request. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AuthorizationRequest(ResponseTypeSet rts, ClientID clientID)
rts
- The response type set. Corresponds to the
response_type
parameter. Must not be
null
.clientID
- The client identifier. Corresponds to the
client_id
parameter. Must not be
null
.public AuthorizationRequest(ResponseTypeSet rts, ClientID clientID, URL redirectURI, Scope scope, State state)
rts
- The response type set. Corresponds to the
response_type
parameter. Must not be
null
.clientID
- The client identifier. Corresponds to the
client_id
parameter. Must not be
null
.redirectURI
- The redirection URI. Corresponds to the optional
redirect_uri
parameter. null
if
not specified.scope
- The request scope. Corresponds to the optional
scope
parameter. null
if not
specified.state
- The state. Corresponds to the recommended
state
parameter. null
if not
specified.Method Detail |
---|
public ResponseTypeSet getResponseTypeSet()
response_type
parameter.
public ClientID getClientID()
client_id
parameter.
public URL getRedirectURI()
redirection_uri
parameter.
null
if not specified.public Scope getScope()
scope
parameter.
null
if not specified.public State getState()
state
parameter.
null
if not specified.public Map<String,String> toParameters() throws SerializeException
Example parameters:
response_type = code client_id = s6BhdRkqt3 state = xyz redirect_uri = https://client.example.com/cb
SerializeException
- If this authorisation request couldn't be
serialised to an parameters map.public String toQueryString() throws SerializeException
Note that the '?' character preceding the query string in an URL is not included in the returned string.
Example URL query string:
response_type=code &client_id=s6BhdRkqt3 &state=xyz &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
SerializeException
- If this authorisation request couldn't be
serialised to an URL query string.public HTTPRequest toHTTPRequest(URL url, HTTPRequest.Method method) throws SerializeException
url
- The URL of the HTTP endpoint for which the request is
intended. Must not be null
.method
- The HTTP request method which can be GET or POST. Must
not be null
.
SerializeException
- If the authorisation request message
couldn't be serialised to an HTTP
request.public HTTPRequest toHTTPRequest(URL url) throws SerializeException
Request
toHTTPRequest
in interface Request
url
- The URL of the HTTP endpoint for which the request is
intended. Must not be null
.
SerializeException
- If the request message couldn't be
serialised to an HTTP request.public static AuthorizationRequest parse(Map<String,String> params) throws ParseException
Example parameters:
response_type = code client_id = s6BhdRkqt3 state = xyz redirect_uri = https://client.example.com/cb
params
- The parameters. Must not be null
.
ParseException
- If the parameters couldn't be parsed to an
authorisation request.public static AuthorizationRequest parse(String query) throws ParseException
Example URL query string:
response_type=code &client_id=s6BhdRkqt3 &state=xyz &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
query
- The URL query string. Must not be null
.
ParseException
- If the query string couldn't be parsed to an
authorisation request.public static AuthorizationRequest parse(HTTPRequest httpRequest) throws ParseException
Example HTTP request (GET):
https://server.example.com/authorize? response_type=code &client_id=s6BhdRkqt3 &state=xyz &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb
httpRequest
- The HTTP request. Must not be null
.
ParseException
- If the HTTP request couldn't be parsed to an
authorisation request.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |