|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nimbusds.oauth2.sdk.AuthorizationResponse
public abstract class AuthorizationResponse
Authorisation endpoint response. This is the base abstract class for authorisation success and error responses.
Related specifications:
Constructor Summary | |
---|---|
protected |
AuthorizationResponse(URL redirectURI,
State state)
Creates a new authorisation response. |
Method Summary | |
---|---|
URL |
getRedirectURI()
Gets the base redirect URI. |
State |
getState()
Gets the optional state. |
static AuthorizationResponse |
parse(HTTPResponse httpResponse)
Parses an authorisation response. |
static AuthorizationResponse |
parse(URL uri)
Parses an authorisation response. |
static AuthorizationResponse |
parse(URL redirectURI,
Map<String,String> params)
Parses an authorisation response. |
HTTPResponse |
toHTTPResponse()
Returns the HTTP response for this authorisation response. |
abstract Map<String,String> |
toParameters()
Returns the parameters of this authorisation response. |
abstract URL |
toURI()
Returns the URI representation (redirect URI + fragment / query string) of this authorisation response. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AuthorizationResponse(URL redirectURI, State state)
redirectURI
- The base redirect URI. Must not be null
.state
- The state, null
if not requested.Method Detail |
---|
public URL getRedirectURI()
public State getState()
null
if not requested.public abstract Map<String,String> toParameters() throws SerializeException
Example parameters (authorisation success):
access_token = 2YotnFZFEjr1zCsicMWpAA state = xyz token_type = example expires_in = 3600
SerializeException
- If this response couldn't be serialised
to a parameters map.public abstract URL toURI() throws SerializeException
Example URI:
http://example.com/cb#access_token=2YotnFZFEjr1zCsicMWpAA &state=xyz &token_type=example &expires_in=3600
SerializeException
- If this response couldn't be serialised
to a URI.public HTTPResponse toHTTPResponse() throws SerializeException
Example HTTP response (authorisation success):
HTTP/1.1 302 Found Location: http://example.com/cb#access_token=2YotnFZFEjr1zCsicMWpAA &state=xyz &token_type=example &expires_in=3600
toHTTPResponse
in interface Response
SerializeException
- If the response couldn't be serialised to
an HTTP response.public static AuthorizationResponse parse(URL redirectURI, Map<String,String> params) throws ParseException
redirectURI
- The base redirect URI. Must not be null
.params
- The response parameters to parse. Must not be
null
.
ParseException
- If the parameters couldn't be parsed to an
authorisation success or error response.public static AuthorizationResponse parse(URL uri) throws ParseException
Use a relative URI if the host, port and path details are not known:
URL relUrl = new URL("http://?code=Qcb0Orv1...&state=af0ifjsldkj"); AuthorizationResponse = AuthorizationResponse.parse(relURL);
uri
- The URL to parse. May be absolute or relative, with a
fragment or query string containing the authorisation
response parameters. Must not be null
.
ParseException
- If no authorisation response parameters were
found in the URL.public static AuthorizationResponse parse(HTTPResponse httpResponse) throws ParseException
Example HTTP response (authorisation success):
HTTP/1.1 302 Found Location: https://client.example.com/cb?code=SplxlOBeZQQYbYS6WxSbIA&state=xyz
httpResponse
- The HTTP response to parse. Must not be
null
.
ParseException
- If the HTTP response couldn't be parsed to an
authorisation response.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |