use of org.forgerock.openam.sts.rest.token.canceller.RestIssuedTokenCancellerParameters in project OpenAM by OpenRock.
the class TokenRequestMarshallerImpl method buildSAML2IssuedTokenCancellerParameters.
private RestIssuedTokenCancellerParameters<SAML2TokenState> buildSAML2IssuedTokenCancellerParameters(JsonValue receivedToken) throws TokenMarshalException {
if (!receivedToken.get(AMSTSConstants.SAML2_TOKEN_KEY).isString()) {
String message = "Exception: json representation of a to-be-cancelled SAML2 token does not contain a " + AMSTSConstants.SAML2_TOKEN_KEY + " field containing the " + "to-be-cancelled token. The representation: " + receivedToken;
throw new TokenMarshalException(ResourceException.BAD_REQUEST, message);
} else {
final String tokenValue = receivedToken.get(AMSTSConstants.SAML2_TOKEN_KEY).asString();
final SAML2TokenState saml2TokenState = SAML2TokenState.builder().tokenValue(tokenValue).build();
return new RestIssuedTokenCancellerParameters<SAML2TokenState>() {
@Override
public SAML2TokenState getInputToken() {
return saml2TokenState;
}
};
}
}
use of org.forgerock.openam.sts.rest.token.canceller.RestIssuedTokenCancellerParameters in project OpenAM by OpenRock.
the class TokenRequestMarshallerImpl method buildOpenIdConnectIssuedTokenCancellerParameters.
private RestIssuedTokenCancellerParameters<OpenIdConnectIdToken> buildOpenIdConnectIssuedTokenCancellerParameters(JsonValue receivedToken) throws TokenMarshalException {
if (!receivedToken.get(AMSTSConstants.OPEN_ID_CONNECT_ID_TOKEN_KEY).isString()) {
String message = "Exception: json representation of a to-be-cancelled OIDC token does not contain a " + AMSTSConstants.OPEN_ID_CONNECT_ID_TOKEN_KEY + " field containing the " + "to-be-cancelled token. The representation: " + receivedToken;
throw new TokenMarshalException(ResourceException.BAD_REQUEST, message);
} else {
final String tokenValue = receivedToken.get(AMSTSConstants.OPEN_ID_CONNECT_ID_TOKEN_KEY).asString();
final OpenIdConnectIdToken openIdConnectIdToken = new OpenIdConnectIdToken(tokenValue);
return new RestIssuedTokenCancellerParameters<OpenIdConnectIdToken>() {
@Override
public OpenIdConnectIdToken getInputToken() {
return openIdConnectIdToken;
}
};
}
}
Aggregations