Search in sources :

Example 1 with TokenCancellerResponse

use of org.apache.cxf.sts.token.canceller.TokenCancellerResponse in project OpenAM by OpenRock.

the class TokenCancellerBase method cancelToken.

@Override
public TokenCancellerResponse cancelToken(TokenCancellerParameters tokenParameters) {
    TokenCancellerResponse response = new TokenCancellerResponse();
    ReceivedToken cancelTarget = tokenParameters.getToken();
    cancelTarget.setState(ReceivedToken.STATE.VALID);
    response.setToken(cancelTarget);
    String tokenServiceConsumptionToken = null;
    try {
        final String tokenId = generateIdFromValidateTarget(cancelTarget);
        tokenServiceConsumptionToken = getTokenServiceConsumptionToken();
        tokenServiceConsumer.cancelToken(tokenId, tokenServiceConsumptionToken);
        cancelTarget.setState(ReceivedToken.STATE.CANCELLED);
        return response;
    } catch (TokenCancellationException e) {
        throw new STSException("Exception caught validating issued token: " + e.getMessage(), e);
    } finally {
        if (tokenServiceConsumptionToken != null) {
            invalidateTokenGenerationServiceConsumptionToken(tokenServiceConsumptionToken);
        }
    }
}
Also used : STSException(org.apache.cxf.ws.security.sts.provider.STSException) ReceivedToken(org.apache.cxf.sts.request.ReceivedToken) TokenCancellationException(org.forgerock.openam.sts.TokenCancellationException) TokenCancellerResponse(org.apache.cxf.sts.token.canceller.TokenCancellerResponse)

Aggregations

ReceivedToken (org.apache.cxf.sts.request.ReceivedToken)1 TokenCancellerResponse (org.apache.cxf.sts.token.canceller.TokenCancellerResponse)1 STSException (org.apache.cxf.ws.security.sts.provider.STSException)1 TokenCancellationException (org.forgerock.openam.sts.TokenCancellationException)1