Class OAuth2AccessTokenJsonExtractor
- java.lang.Object
-
- com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor
-
- All Implemented Interfaces:
TokenExtractor<OAuth2AccessToken>
public class OAuth2AccessTokenJsonExtractor extends Object implements TokenExtractor<OAuth2AccessToken>
JSON (default) implementation ofTokenExtractor
for OAuth 2.0
-
-
Field Summary
Fields Modifier and Type Field Description protected static com.fasterxml.jackson.databind.ObjectMapper
OBJECT_MAPPER
-
Constructor Summary
Constructors Modifier Constructor Description protected
OAuth2AccessTokenJsonExtractor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected OAuth2AccessToken
createToken(String accessToken, String tokenType, Integer expiresIn, String refreshToken, String scope, com.fasterxml.jackson.databind.JsonNode response, String rawResponse)
OAuth2AccessToken
extract(Response response)
Extracts the concrete type of token from the contents of an Http Responseprotected static com.fasterxml.jackson.databind.JsonNode
extractRequiredParameter(com.fasterxml.jackson.databind.JsonNode errorNode, String parameterName, String rawResponse)
void
generateError(String rawResponse)
Related documentation: https://tools.ietf.org/html/rfc6749#section-5.2static OAuth2AccessTokenJsonExtractor
instance()
-
-
-
Method Detail
-
instance
public static OAuth2AccessTokenJsonExtractor instance()
-
extract
public OAuth2AccessToken extract(Response response) throws IOException
Description copied from interface:TokenExtractor
Extracts the concrete type of token from the contents of an Http Response- Specified by:
extract
in interfaceTokenExtractor<OAuth2AccessToken>
- Parameters:
response
- the whole response- Returns:
- OAuth access token
- Throws:
IOException
- in case of troubles while getting body from the response
-
generateError
public void generateError(String rawResponse) throws IOException
Related documentation: https://tools.ietf.org/html/rfc6749#section-5.2- Parameters:
rawResponse
- response- Throws:
IOException
- IOException
-
createToken
protected OAuth2AccessToken createToken(String accessToken, String tokenType, Integer expiresIn, String refreshToken, String scope, com.fasterxml.jackson.databind.JsonNode response, String rawResponse)
-
extractRequiredParameter
protected static com.fasterxml.jackson.databind.JsonNode extractRequiredParameter(com.fasterxml.jackson.databind.JsonNode errorNode, String parameterName, String rawResponse) throws OAuthException
- Throws:
OAuthException
-
-