@PostMapping(value = {
        '/' + OidcConstants.BASE_OIDC_URL + '/' + OidcConstants.REGISTRATION_URL,
        "/**/" + OidcConstants.REGISTRATION_URL
    }, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    @Operation(summary = "Handle OIDC dynamic client registration request",
        requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
            description = "Client registration request",
            content = @Content(
                mediaType = MediaType.APPLICATION_JSON_VALUE,
                schema = @Schema(implementation = OidcClientRegistrationRequest.class)
            )
        ))
    public ResponseEntity handleRequestInternal(
        @RequestBody
        final String jsonInput,
        final HttpServletRequest request,
        final HttpServletResponse response) {

        val webContext = new JEEContext(request, response);
        if (!getConfigurationContext().getIssuerService().validateIssuer(webContext, List.of(OidcConstants.REGISTRATION_URL))) {
            val body = OAuth20Utils.getErrorResponseBody(OAuth20Constants.INVALID_REQUEST, "Invalid issuer");
            return new ResponseEntity(body, HttpStatus.BAD_REQUEST);
        }
        try {
            val registrationRequest = (OidcClientRegistrationRequest) getConfigurationContext()
                .getClientRegistrationRequestSerializer().from(jsonInput);
            LOGGER.debug("Received client registration request [{}]", registrationRequest);
            val registeredService = getConfigurationContext().getClientRegistrationRequestTranslator()
                .translate(registrationRequest, Optional.empty());
            registeredService.markAsDynamicallyRegistered();

            val savedService = (OidcRegisteredService) getConfigurationContext().getServicesManager().save(registeredService);
            val clientResponse = OidcClientRegistrationUtils.getClientRegistrationResponse(savedService,
                getConfigurationContext().getCasProperties().getServer().getPrefix());
            val accessToken = generateRegistrationAccessToken(request, response, savedService, registrationRequest);

            val cipher = OAuth20JwtAccessTokenEncoder.toEncodableCipher(getConfigurationContext(),
                savedService, accessToken, accessToken.getService(), false);
            val encodedAccessToken = cipher.encode(accessToken.getId());
            clientResponse.setRegistrationAccessToken(encodedAccessToken);
            return new ResponseEntity<>(clientResponse, HttpStatus.CREATED);
        } catch (final Throwable e) {
            LoggingUtils.error(LOGGER, e);
            val map = OAuth20Utils.getErrorResponseBody("invalid_client_metadata",
                StringUtils.defaultIfBlank(e.getMessage(), "None"));
            return new ResponseEntity<>(map, HttpStatus.BAD_REQUEST);
        }
    }
Handle request.

@param jsonInput the json input
@param request   the request
@param response  the response
@return the model and view
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/web/controllers/dynareg/OidcDynamicClientRegistrationEndpointController.java