@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(URI redirectURI,
AccessToken accessToken,
State state)
Creates a new authorisation success response in the implicit flow
(implicit grant).
|
AuthorizationSuccessResponse(URI redirectURI,
AuthorizationCode code,
AccessToken accessToken,
State state)
Creates a new authorisation success response.
|
AuthorizationSuccessResponse(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(URI uri)
Parses an authorisation success response.
|
static AuthorizationSuccessResponse |
parse(URI redirectURI,
Map<String,String> params)
Parses an authorisation success response.
|
Map<String,String> |
toParameters()
Returns the parameters of this authorisation response.
|
URI |
toURI()
Returns the URI representation (redirection URI + fragment / query
string) of this authorisation response.
|
getRedirectionURI, getState, toHTTPResponse
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toHTTPResponse
public AuthorizationSuccessResponse(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(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(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 Map<String,String> toParameters() throws SerializeException
AuthorizationResponse
Example parameters (authorisation success):
access_token = 2YotnFZFEjr1zCsicMWpAA state = xyz token_type = example expires_in = 3600
toParameters
in class AuthorizationResponse
SerializeException
- If this response couldn't be serialised
to a parameters map.public URI toURI() throws SerializeException
AuthorizationResponse
Example URI:
http://example.com/cb#access_token=2YotnFZFEjr1zCsicMWpAA &state=xyz &token_type=example &expires_in=3600
toURI
in class AuthorizationResponse
SerializeException
- If this response couldn't be serialised
to a URI.public static AuthorizationSuccessResponse parse(URI redirectURI, Map<String,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(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 NimbusDS. All Rights Reserved.