@Override
    public Optional<OAuth20AuthorizationRequest.OAuth20AuthorizationRequestBuilder> toAuthorizationRequest(
        final WebContext context,
        final Authentication authentication,
        final Service service,
        final OAuthRegisteredService registeredService) {

        val requestUri = context.getRequestParameter(OidcConstants.REQUEST_URI);
        if (context.getRequestURL().endsWith(OidcConstants.AUTHORIZE_URL) && requestUri.isEmpty()) {
            return Optional.empty();
        }

        val authzRequestBuilder = super.toAuthorizationRequest(context, authentication, service, registeredService).orElseThrow();
        return requestUri
            .map(Unchecked.function(uri -> {
                val factory = (OidcPushedAuthorizationRequestFactory) configurationContext.getTicketFactory().get(OidcPushedAuthorizationRequest.class);
                val pushAuthzTicket = configurationContext.getTicketRegistry().getTicket(uri, OidcPushedAuthorizationRequest.class);
                FunctionUtils.doIf(pushAuthzTicket.isExpired(), Unchecked.consumer(r -> configurationContext.getTicketRegistry().deleteTicket(pushAuthzTicket)),
                    Unchecked.consumer(r -> configurationContext.getTicketRegistry().updateTicket(pushAuthzTicket))).accept(pushAuthzTicket);
                val tgt = configurationContext.fetchTicketGrantingTicketFrom((JEEContext) context);

                val pushAuthzAuthentication = DefaultAuthenticationBuilder.newInstance(tgt.getAuthentication())
                    .mergeAttributes(pushAuthzTicket.getAuthentication().getAttributes())
                    .build();
                val tokenRequest = factory.toAccessTokenRequest(pushAuthzTicket)
                    .withTicketGrantingTicket(tgt)
                    .withAuthentication(pushAuthzAuthentication);
                pushAuthzTicket.update();
                configurationContext.getTicketRegistry().updateTicket(pushAuthzTicket);

                val value = authzRequestBuilder.accessTokenRequest(tokenRequest)
                    .responseType(tokenRequest.getResponseType().getType())
                    .clientId(tokenRequest.getClientId())
                    .grantType(tokenRequest.getGrantType().getType());
                return Optional.of(value);
            }))
            .orElseGet(() -> Optional.of(authzRequestBuilder.singleSignOnSessionRequired(!context.getRequestURL().endsWith(OidcConstants.PUSHED_AUTHORIZE_URL))));
    }
This is {@link OidcPushedAuthorizationRequestUriResponseBuilder}.

@author Misagh Moayyed
@since 5.2.0
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/web/OidcPushedAuthorizationRequestUriResponseBuilder.java