Package com.nimbusds.oauth2.sdk
Class TokenResponse
java.lang.Object
com.nimbusds.oauth2.sdk.TokenResponse
- Direct Known Subclasses:
AccessTokenResponse
,TokenErrorResponse
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.Casts this response to a token error response.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 Details
-
TokenResponse
public TokenResponse()
-
-
Method Details
-
toSuccessResponse
Casts this response to an access token response.- Returns:
- The access token response.
-
toErrorResponse
Casts this response to a token error response.- Returns:
- The token error response.
-
parse
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
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.
-