@Immutable public class AuthorizationSuccessResponse extends AuthorizationResponse implements SuccessResponse
Example HTTP response with code (code flow):
HTTP/1.1 302 Found Location: https://client.example.com/cb?code=SplxlOBeZQQYbYS6WxSbIA&state=xyz
Example HTTP response with access token (implicit flow):
HTTP/1.1 302 Found
Location: http://example.com/cb#access_token=2YotnFZFEjr1zCsicMWpAA
&state=xyz&token_type=Bearer&expires_in=3600
Related specifications:
| Constructor and Description |
|---|
AuthorizationSuccessResponse(java.net.URI redirectURI,
AccessToken accessToken,
State state)
Creates a new authorisation success response in the implicit flow
(implicit grant).
|
AuthorizationSuccessResponse(java.net.URI redirectURI,
AuthorizationCode code,
AccessToken accessToken,
State state)
Creates a new authorisation success response.
|
AuthorizationSuccessResponse(java.net.URI redirectURI,
AuthorizationCode code,
State state)
Creates a new authorisation success response in the code flow
(authorisation code grant).
|
| Modifier and Type | Method and Description |
|---|---|
AccessToken |
getAccessToken()
Gets the access token.
|
AuthorizationCode |
getAuthorizationCode()
Gets the authorisation code.
|
ResponseType |
impliedResponseType()
Returns the implied response type.
|
static AuthorizationSuccessResponse |
parse(HTTPResponse httpResponse)
Parses an authorisation success response.
|
static AuthorizationSuccessResponse |
parse(java.net.URI uri)
Parses an authorisation success response.
|
static AuthorizationSuccessResponse |
parse(java.net.URI redirectURI,
java.util.Map<java.lang.String,java.lang.String> params)
Parses an authorisation success response.
|
java.util.Map<java.lang.String,java.lang.String> |
toParameters()
Returns the parameters of this authorisation response.
|
java.net.URI |
toURI()
Returns the URI representation (redirection URI + fragment / query
string) of this authorisation response.
|
getRedirectionURI, getState, toHTTPResponseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittoHTTPResponsepublic AuthorizationSuccessResponse(java.net.URI redirectURI, AuthorizationCode code, State state)
redirectURI - The base redirection URI. Must not be
null.code - The authorisation code. Must not be null.state - The state, null if not requested.public AuthorizationSuccessResponse(java.net.URI redirectURI, AccessToken accessToken, State state)
redirectURI - The base redirection URI. Must not be
null.accessToken - The access token. Must not be null.state - The state, null if not requested.public AuthorizationSuccessResponse(java.net.URI redirectURI, AuthorizationCode code, AccessToken accessToken, State state)
redirectURI - The base redirection URI. Must not be
null.code - The authorisation code, null if not
requested.accessToken - The access token, null if not requested.state - The state, null if not requested.public ResponseType impliedResponseType()
public AuthorizationCode getAuthorizationCode()
null if not requested.public AccessToken getAccessToken()
null if not requested.public java.util.Map<java.lang.String,java.lang.String> toParameters() throws SerializeException
AuthorizationResponseExample parameters (authorisation success):
access_token = 2YotnFZFEjr1zCsicMWpAA state = xyz token_type = example expires_in = 3600
toParameters in class AuthorizationResponseSerializeException - If this response couldn't be serialised
to a parameters map.public java.net.URI toURI() throws SerializeException
AuthorizationResponseExample URI:
http://example.com/cb#access_token=2YotnFZFEjr1zCsicMWpAA &state=xyz &token_type=example &expires_in=3600
toURI in class AuthorizationResponseSerializeException - If this response couldn't be serialised
to a URI.public static AuthorizationSuccessResponse parse(java.net.URI redirectURI, java.util.Map<java.lang.String,java.lang.String> params) throws ParseException
redirectURI - The base redirection 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 response.public static AuthorizationSuccessResponse parse(java.net.URI uri) throws ParseException
Example URI:
https://client.example.com/cb?code=SplxlOBeZQQYbYS6WxSbIA&state=xyz
uri - The URI to parse. Can be absolute or relative, with a
fragment or query string containing the authorisation
response parameters. Must not be null.ParseException - If the redirection URI couldn't be parsed to
an authorisation success response.public static AuthorizationSuccessResponse parse(HTTPResponse httpResponse) throws ParseException
Example HTTP response:
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 success response.Copyright © 2014 Connect2id Ltd.. All Rights Reserved.