|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nimbusds.oauth2.sdk.AuthorizationResponse
com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse
@Immutable public class AuthorizationSuccessResponse
Authorisation success response. Used to return an authorization code or access token at the Authorisation endpoint. This class is immutable.
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 Summary | |
---|---|
AuthorizationSuccessResponse(URL redirectURI,
AccessToken accessToken,
State state)
Creates a new authorisation success response in the implicit flow (implicit grant). |
|
AuthorizationSuccessResponse(URL redirectURI,
AuthorizationCode code,
AccessToken accessToken,
State state)
Creates a new authorisation success response. |
|
AuthorizationSuccessResponse(URL redirectURI,
AuthorizationCode code,
State state)
Creates a new authorisation success response in the code flow (authorisation code grant). |
Method Summary | |
---|---|
AccessToken |
getAccessToken()
Gets the access token. |
AuthorizationCode |
getAuthorizationCode()
Gets the authorisation code. |
ResponseTypeSet |
getImpliedResponseTypeSet()
Gets the implied response type set. |
static AuthorizationSuccessResponse |
parse(HTTPResponse httpResponse)
Parses an authorisation success response. |
static AuthorizationSuccessResponse |
parse(URL uri)
Parses an authorisation success response. |
static AuthorizationSuccessResponse |
parse(URL redirectURI,
Map<String,String> params)
Parses an authorisation success response. |
Map<String,String> |
toParameters()
Returns the parameters of this authorisation response. |
URL |
toURI()
Returns the URI representation (redirect URI + fragment / query string) of this authorisation response. |
Methods inherited from class com.nimbusds.oauth2.sdk.AuthorizationResponse |
---|
getRedirectURI, getState, toHTTPResponse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.nimbusds.oauth2.sdk.Response |
---|
toHTTPResponse |
Constructor Detail |
---|
public AuthorizationSuccessResponse(URL redirectURI, AuthorizationCode code, State state)
redirectURI
- The base redirect URI. Must not be null
.code
- The authorisation code. Must not be null
.state
- The state, null
if not requested.public AuthorizationSuccessResponse(URL redirectURI, AccessToken accessToken, State state)
redirectURI
- The base redirect URI. Must not be null
.accessToken
- The access token. Must not be null
.state
- The state, null
if not requested.public AuthorizationSuccessResponse(URL redirectURI, AuthorizationCode code, AccessToken accessToken, State state)
redirectURI
- The base redirect 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.Method Detail |
---|
public ResponseTypeSet getImpliedResponseTypeSet()
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 URL 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(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 response.public static AuthorizationSuccessResponse parse(URL 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 redirect 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |