use of de.ids_mannheim.korap.oauth2.oltu.OAuth2RevokeTokenRequest in project Kustvakt by KorAP.
the class OAuth2Controller method revokeAccessToken.
/**
* Revokes either an access token or a refresh token. Revoking a
* refresh token also revokes all access token associated with the
* refresh token.
*
* RFC 7009
* Client authentication for confidential client
*
* @param request
* @param form
* containing
* client_id,
* client_secret (required for confidential clients),
* token,
* token_type (optional)
* @return 200 if token invalidation is successful or the given
* token is invalid
*/
@POST
@Path("revoke")
@ResourceFilters({ APIVersionFilter.class })
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response revokeAccessToken(@Context HttpServletRequest request, MultivaluedMap<String, String> form) {
try {
OAuth2RevokeTokenRequest revokeTokenRequest = new OAuth2RevokeTokenRequest(new FormRequestWrapper(request, form));
tokenService.revokeToken(revokeTokenRequest);
return Response.ok("SUCCESS").build();
} catch (OAuthProblemException e) {
throw responseHandler.throwit(e);
} catch (OAuthSystemException e) {
throw responseHandler.throwit(e);
} catch (KustvaktException e) {
throw responseHandler.throwit(e);
}
}
Aggregations