Package com.nimbusds.oauth2.sdk
Class TokenResponse
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.TokenResponse
-
- Direct Known Subclasses:
AccessTokenResponse
,TokenErrorResponse
public abstract class TokenResponse extends Object implements Response
Token endpoint response. This is the base abstract class for access token (success) and token error responses.Related specifications:
- OAuth 2.0 (RFC 6749), section 3.2.
-
-
Constructor Summary
Constructors Constructor Description TokenResponse()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TokenResponse
parse(HTTPResponse httpResponse)
Parses a token response from the specified HTTP response.static TokenResponse
parse(net.minidev.json.JSONObject jsonObject)
Parses a token response from the specified JSON object.TokenErrorResponse
toErrorResponse()
Casts this response to a token error response.AccessTokenResponse
toSuccessResponse()
Casts this response to an access token response.-
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
indicatesSuccess, toHTTPResponse
-
-
-
-
Constructor Detail
-
TokenResponse
public TokenResponse()
-
-
Method Detail
-
toSuccessResponse
public AccessTokenResponse toSuccessResponse()
Casts this response to an access token response.- Returns:
- The access token response.
-
toErrorResponse
public TokenErrorResponse toErrorResponse()
Casts this response to a token error response.- Returns:
- The token error response.
-
parse
public static TokenResponse parse(net.minidev.json.JSONObject jsonObject) throws ParseException
Parses a token response from the specified JSON object.- Parameters:
jsonObject
- The JSON object to parse. Must not benull
.- Returns:
- The access token or token error response.
- Throws:
ParseException
- If the JSON object couldn't be parsed to a token response.
-
parse
public static TokenResponse parse(HTTPResponse httpResponse) throws ParseException
Parses a token response from the specified HTTP response.- Parameters:
httpResponse
- The HTTP response. Must not benull
.- Returns:
- The access token or token error response.
- Throws:
ParseException
- If the HTTP response couldn't be parsed to a token response.
-
-