64 ClientDetailsEntity authClient = null;
66 if (auth instanceof OAuth2Authentication) {
68 ensureOAuthScope(auth, SystemScopeService.UMA_PROTECTION_SCOPE);
70 OAuth2Authentication o2a = (OAuth2Authentication) auth;
72 String authClientId = o2a.getOAuth2Request().getClientId();
76 String ownerId = o2a.getUserAuthentication().getName();
81 String authClientId = auth.getName();
92 if (!accessToken.getClient().getClientId().equals(authClient.getClientId())) {
95 logger.info(
"Client " + authClient.getClientId() +
" tried to revoke a token owned by " + accessToken.getClient().getClientId());
97 model.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN);
98 return HttpCodeView.VIEWNAME;
104 logger.debug(
"Client " + authClient.getClientId() +
" revoked access token " + tokenValue);
106 model.addAttribute(HttpCodeView.CODE, HttpStatus.OK);
107 return HttpCodeView.VIEWNAME;
109 }
catch (InvalidTokenException e) {
116 if (!refreshToken.getClient().getClientId().equals(authClient.getClientId())) {
119 logger.info(
"Client " + authClient.getClientId() +
" tried to revoke a token owned by " + refreshToken.getClient().getClientId());
121 model.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN);
122 return HttpCodeView.VIEWNAME;
128 logger.debug(
"Client " + authClient.getClientId() +
" revoked access token " + tokenValue);
130 model.addAttribute(HttpCodeView.CODE, HttpStatus.OK);
131 return HttpCodeView.VIEWNAME;
133 }
catch (InvalidTokenException e1) {
137 logger.debug(
"Failed to revoke token " + tokenValue);
139 model.addAttribute(HttpCodeView.CODE, HttpStatus.OK);
140 return HttpCodeView.VIEWNAME;
OAuth2RefreshTokenEntity getRefreshToken(String refreshTokenValue)
OAuth2TokenEntityService tokenServices
Definition: RevocationEndpoint.java:48
ClientDetailsEntityService clientService
Definition: RevocationEndpoint.java:45
static final Logger logger
Definition: RevocationEndpoint.java:53
ClientDetailsEntity loadClientByClientId(String clientId)
void revokeRefreshToken(OAuth2RefreshTokenEntity refreshToken)
OAuth2AccessTokenEntity readAccessToken(String accessTokenValue)
void revokeAccessToken(OAuth2AccessTokenEntity accessToken)