Search in sources :

Example 1 with OpenIdConnectTokenCreationState

use of org.forgerock.openam.sts.rest.token.provider.oidc.OpenIdConnectTokenCreationState in project OpenAM by OpenRock.

the class TokenRequestMarshallerImpl method createOpenIdConnectTokenProviderParameters.

private RestTokenProviderParameters<OpenIdConnectTokenCreationState> createOpenIdConnectTokenProviderParameters(final TokenTypeId inputTokenType, final JsonValue inputToken, final JsonValue desiredToken) throws TokenMarshalException {
    org.forgerock.openam.sts.user.invocation.OpenIdConnectTokenCreationState userSpecifiedTokenCreationState = org.forgerock.openam.sts.user.invocation.OpenIdConnectTokenCreationState.fromJson(desiredToken);
    if (!userSpecifiedTokenCreationState.getAllowAccess()) {
        throw new TokenMarshalException(ResourceException.BAD_REQUEST, "The OpenIdConnectTokenCreation state must " + "indicate access to the caller's identity with a field of allow_access:true.");
    }
    final OpenIdConnectTokenCreationState openIdConnectTokenCreationState = new OpenIdConnectTokenCreationState(userSpecifiedTokenCreationState.getNonce(), System.currentTimeMillis() / 1000);
    return new OpenIdConnectRestTokenProviderParameters(openIdConnectTokenCreationState, inputTokenType, inputToken);
}
Also used : TokenMarshalException(org.forgerock.openam.sts.TokenMarshalException) OpenIdConnectRestTokenProviderParameters(org.forgerock.openam.sts.rest.operation.translate.OpenIdConnectRestTokenProviderParameters) OpenIdConnectTokenCreationState(org.forgerock.openam.sts.rest.token.provider.oidc.OpenIdConnectTokenCreationState)

Aggregations

TokenMarshalException (org.forgerock.openam.sts.TokenMarshalException)1 OpenIdConnectRestTokenProviderParameters (org.forgerock.openam.sts.rest.operation.translate.OpenIdConnectRestTokenProviderParameters)1 OpenIdConnectTokenCreationState (org.forgerock.openam.sts.rest.token.provider.oidc.OpenIdConnectTokenCreationState)1