Java Code Examples for org.gluu.oxauth.client.RegisterRequest#getUserInfoEncryptedResponseAlg()

The following examples show how to use org.gluu.oxauth.client.RegisterRequest#getUserInfoEncryptedResponseAlg() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RegisterParamsValidator.java    From oxAuth with MIT License 4 votes vote down vote up
/**
 * Validates all algorithms received for a register client request. It throws a WebApplicationException
 * whether a validation doesn't pass.
 *
 * @param registerRequest Object containing all parameters received to register a client.
 */
public void validateAlgorithms( RegisterRequest registerRequest ) {
    if ( registerRequest.getIdTokenSignedResponseAlg() != null
            && registerRequest.getIdTokenSignedResponseAlg() != SignatureAlgorithm.NONE &&
            ! appConfiguration.getIdTokenSigningAlgValuesSupported().contains(
                    registerRequest.getIdTokenSignedResponseAlg().toString()) ) {
        log.debug("Parameter id_token_signed_response_alg is not valid.");
        throw errorResponseFactory.createWebApplicationException(Response.Status.BAD_REQUEST,
                RegisterErrorResponseType.INVALID_CLIENT_METADATA, "Parameter id_token_signed_response_alg is not valid.");
    }

    if ( registerRequest.getIdTokenEncryptedResponseAlg() != null &&
            ! appConfiguration.getIdTokenEncryptionAlgValuesSupported().contains(
                    registerRequest.getIdTokenEncryptedResponseAlg().toString()) ) {
        log.debug("Parameter id_token_encrypted_response_alg is not valid.");
        throw errorResponseFactory.createWebApplicationException(Response.Status.BAD_REQUEST,
                RegisterErrorResponseType.INVALID_CLIENT_METADATA, "Parameter id_token_encrypted_response_alg is not valid.");
    }

    if ( registerRequest.getIdTokenEncryptedResponseEnc() != null &&
            ! appConfiguration.getIdTokenEncryptionEncValuesSupported().contains(
                    registerRequest.getIdTokenEncryptedResponseEnc().toString()) ) {
        log.debug("Parameter id_token_encrypted_response_enc is not valid.");
        throw errorResponseFactory.createWebApplicationException(Response.Status.BAD_REQUEST,
                RegisterErrorResponseType.INVALID_CLIENT_METADATA, "Parameter id_token_encrypted_response_enc is not valid.");
    }

    if ( registerRequest.getUserInfoSignedResponseAlg() != null &&
            ! appConfiguration.getUserInfoSigningAlgValuesSupported().contains(
                    registerRequest.getUserInfoSignedResponseAlg().toString()) ) {
        log.debug("Parameter userinfo_signed_response_alg is not valid.");
        throw errorResponseFactory.createWebApplicationException(Response.Status.BAD_REQUEST,
                RegisterErrorResponseType.INVALID_CLIENT_METADATA, "Parameter userinfo_signed_response_alg is not valid.");
    }

    if ( registerRequest.getUserInfoEncryptedResponseAlg() != null &&
            ! appConfiguration.getUserInfoEncryptionAlgValuesSupported().contains(
                    registerRequest.getUserInfoEncryptedResponseAlg().toString()) ) {
        log.debug("Parameter userinfo_encrypted_response_alg is not valid.");
        throw errorResponseFactory.createWebApplicationException(Response.Status.BAD_REQUEST,
                RegisterErrorResponseType.INVALID_CLIENT_METADATA, "Parameter userinfo_encrypted_response_alg is not valid.");
    }

    if ( registerRequest.getUserInfoEncryptedResponseEnc() != null &&
            ! appConfiguration.getUserInfoEncryptionEncValuesSupported().contains(
                    registerRequest.getUserInfoEncryptedResponseEnc().toString()) ) {
        log.debug("Parameter userinfo_encrypted_response_enc is not valid.");
        throw errorResponseFactory.createWebApplicationException(Response.Status.BAD_REQUEST,
                RegisterErrorResponseType.INVALID_CLIENT_METADATA, "Parameter userinfo_encrypted_response_enc is not valid.");
    }

    if ( registerRequest.getRequestObjectSigningAlg() != null &&
            ! appConfiguration.getRequestObjectSigningAlgValuesSupported().contains(
                    registerRequest.getRequestObjectSigningAlg().toString()) ) {
        log.debug("Parameter request_object_signing_alg is not valid.");
        throw errorResponseFactory.createWebApplicationException(Response.Status.BAD_REQUEST,
                RegisterErrorResponseType.INVALID_CLIENT_METADATA, "Parameter request_object_signing_alg is not valid.");
    }

    if ( registerRequest.getRequestObjectEncryptionAlg() != null &&
            ! appConfiguration.getRequestObjectEncryptionAlgValuesSupported().contains(
                    registerRequest.getRequestObjectEncryptionAlg().toString()) ) {
        log.debug("Parameter request_object_encryption_alg is not valid.");
        throw errorResponseFactory.createWebApplicationException(Response.Status.BAD_REQUEST,
                RegisterErrorResponseType.INVALID_CLIENT_METADATA, "Parameter request_object_encryption_alg is not valid.");
    }

    if ( registerRequest.getRequestObjectEncryptionEnc() != null &&
            ! appConfiguration.getRequestObjectEncryptionEncValuesSupported().contains(
                    registerRequest.getRequestObjectEncryptionEnc().toString()) ) {
        log.debug("Parameter request_object_encryption_enc is not valid.");
        throw errorResponseFactory.createWebApplicationException(Response.Status.BAD_REQUEST,
                RegisterErrorResponseType.INVALID_CLIENT_METADATA, "Parameter request_object_encryption_enc is not valid.");
    }

    if ( registerRequest.getTokenEndpointAuthMethod() != null &&
            ! appConfiguration.getTokenEndpointAuthMethodsSupported().contains(
                    registerRequest.getTokenEndpointAuthMethod().toString()) ) {
        log.debug("Parameter token_endpoint_auth_method is not valid.");
        throw errorResponseFactory.createWebApplicationException(Response.Status.BAD_REQUEST,
                RegisterErrorResponseType.INVALID_CLIENT_METADATA, "Parameter token_endpoint_auth_method is not valid.");
    }

    if ( registerRequest.getTokenEndpointAuthSigningAlg() != null &&
            ! appConfiguration.getTokenEndpointAuthSigningAlgValuesSupported().contains(
                    registerRequest.getTokenEndpointAuthSigningAlg().toString()) ) {
        log.debug("Parameter token_endpoint_auth_signing_alg is not valid.");
        throw errorResponseFactory.createWebApplicationException(Response.Status.BAD_REQUEST,
                RegisterErrorResponseType.INVALID_CLIENT_METADATA, "Parameter token_endpoint_auth_signing_alg is not valid.");
    }
}