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 ofTokenExtractorfor OAuth 2.0
-
-
Field Summary
Fields Modifier and Type Field Description protected static com.fasterxml.jackson.databind.ObjectMapperOBJECT_MAPPER
-
Constructor Summary
Constructors Modifier Constructor Description protectedOAuth2AccessTokenJsonExtractor()
-
Method Summary
Modifier and Type Method Description protected OAuth2AccessTokencreateToken(String accessToken, String tokenType, Integer expiresIn, String refreshToken, String scope, com.fasterxml.jackson.databind.JsonNode response, String rawResponse)OAuth2AccessTokenextract(Response response)Extracts the concrete type of token from the contents of an Http Responseprotected static com.fasterxml.jackson.databind.JsonNodeextractRequiredParameter(com.fasterxml.jackson.databind.JsonNode errorNode, String parameterName, String rawResponse)voidgenerateError(String rawResponse)Related documentation: https://tools.ietf.org/html/rfc6749#section-5.2static OAuth2AccessTokenJsonExtractorinstance()
-
-
-
Method Detail
-
instance
public static OAuth2AccessTokenJsonExtractor instance()
-
extract
public OAuth2AccessToken extract(Response response) throws IOException
Description copied from interface:TokenExtractorExtracts the concrete type of token from the contents of an Http Response- Specified by:
extractin 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
-
-