use of io.getlime.security.powerauth.rest.api.model.response.v3.TokenRemoveResponse in project powerauth-restful-integration by lime-company.
the class TokenService method removeToken.
/**
* Remove token.
*
* @param request Remove token request.
* @param authentication PowerAuth API authentication object.
* @return Remove token response.
* @throws PowerAuthAuthenticationException In case authentication fails.
*/
public TokenRemoveResponse removeToken(TokenRemoveRequest request, PowerAuthApiAuthentication authentication) throws PowerAuthAuthenticationException {
try {
// Fetch activation ID
final String activationId = authentication.getActivationContext().getActivationId();
// Fetch token ID from the request
final String tokenId = request.getTokenId();
// Remove a token, ignore response, since the endpoint should quietly return
powerAuthClient.removeToken(tokenId, activationId);
// Prepare a response
final TokenRemoveResponse response = new TokenRemoveResponse();
response.setTokenId(tokenId);
return response;
} catch (Exception ex) {
logger.warn("Removing PowerAuth token failed, error: {}", ex.getMessage());
logger.debug(ex.getMessage(), ex);
throw new PowerAuthTokenErrorException();
}
}
Aggregations