Search in sources :

Example 1 with OpenIdConnectIdToken

use of org.forgerock.openam.sts.token.model.OpenIdConnectIdToken in project OpenAM by OpenRock.

the class TokenRequestMarshallerImpl method buildOpenIdConnectIdTokenTransformValidatorParameters.

private RestTokenTransformValidatorParameters<OpenIdConnectIdToken> buildOpenIdConnectIdTokenTransformValidatorParameters(JsonValue receivedToken) throws TokenMarshalException {
    if (!receivedToken.get(AMSTSConstants.OPEN_ID_CONNECT_ID_TOKEN_KEY).isString()) {
        String message = "Exception: json representation of Open ID Connect ID Token does not contain a " + AMSTSConstants.OPEN_ID_CONNECT_ID_TOKEN_KEY + " field. 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 RestTokenTransformValidatorParameters<OpenIdConnectIdToken>() {

            @Override
            public OpenIdConnectIdToken getInputToken() {
                return openIdConnectIdToken;
            }
        };
    }
}
Also used : RestTokenTransformValidatorParameters(org.forgerock.openam.sts.rest.token.validator.RestTokenTransformValidatorParameters) TokenMarshalException(org.forgerock.openam.sts.TokenMarshalException) OpenIdConnectIdToken(org.forgerock.openam.sts.token.model.OpenIdConnectIdToken)

Example 2 with OpenIdConnectIdToken

use of org.forgerock.openam.sts.token.model.OpenIdConnectIdToken in project OpenAM by OpenRock.

the class TokenRequestMarshallerImpl method buildOpenIdConnectIssuedTokenValidatorParameters.

private RestIssuedTokenValidatorParameters<OpenIdConnectIdToken> buildOpenIdConnectIssuedTokenValidatorParameters(JsonValue receivedToken) throws TokenMarshalException {
    if (!receivedToken.get(AMSTSConstants.OPEN_ID_CONNECT_ID_TOKEN_KEY).isString()) {
        String message = "Exception: json representation of a to-be-validated OIDC token does not contain a " + AMSTSConstants.OPEN_ID_CONNECT_ID_TOKEN_KEY + " field containing the " + "to-be-validated 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 RestIssuedTokenValidatorParameters<OpenIdConnectIdToken>() {

            @Override
            public OpenIdConnectIdToken getInputToken() {
                return openIdConnectIdToken;
            }
        };
    }
}
Also used : RestIssuedTokenValidatorParameters(org.forgerock.openam.sts.rest.token.validator.RestIssuedTokenValidatorParameters) TokenMarshalException(org.forgerock.openam.sts.TokenMarshalException) OpenIdConnectIdToken(org.forgerock.openam.sts.token.model.OpenIdConnectIdToken)

Example 3 with OpenIdConnectIdToken

use of org.forgerock.openam.sts.token.model.OpenIdConnectIdToken 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;
            }
        };
    }
}
Also used : TokenMarshalException(org.forgerock.openam.sts.TokenMarshalException) OpenIdConnectIdToken(org.forgerock.openam.sts.token.model.OpenIdConnectIdToken) RestIssuedTokenCancellerParameters(org.forgerock.openam.sts.rest.token.canceller.RestIssuedTokenCancellerParameters)

Aggregations

TokenMarshalException (org.forgerock.openam.sts.TokenMarshalException)3 OpenIdConnectIdToken (org.forgerock.openam.sts.token.model.OpenIdConnectIdToken)3 RestIssuedTokenCancellerParameters (org.forgerock.openam.sts.rest.token.canceller.RestIssuedTokenCancellerParameters)1 RestIssuedTokenValidatorParameters (org.forgerock.openam.sts.rest.token.validator.RestIssuedTokenValidatorParameters)1 RestTokenTransformValidatorParameters (org.forgerock.openam.sts.rest.token.validator.RestTokenTransformValidatorParameters)1