-
-
Save bryantp/70bf538626661a623f5099b704872938 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public OAuth2Authentication loadAuthentication(String accessToken) throws AuthenticationException, InvalidTokenException { | |
MultiValueMap<String, String> formData = new LinkedMultiValueMap<String, String>(); | |
formData.add(tokenName, accessToken); | |
HttpHeaders headers = new HttpHeaders(); | |
headers.set("Authorization", getAuthorizationHeader(clientId, clientSecret)); | |
Map<String, Object> map = postForMap(checkTokenEndpointUrl, formData, headers); | |
if (map.containsKey("error")) { | |
logger.debug("check_token returned error: " + map.get("error")); | |
throw new InvalidTokenException(accessToken); | |
} | |
Assert.state(map.containsKey("client_id"), "Client id must be present in response from auth server"); | |
return tokenConverter.extractAuthentication(map); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment