protected ResponseEntity generateRequestingPartyToken(
        final HttpServletRequest request, final HttpServletResponse response,
        final UserProfile profileResult, final UmaAuthorizationRequest umaRequest,
        final UmaPermissionTicket permissionTicket) throws Throwable {
        val currentAat = (OAuth20AccessToken) profileResult.getAttribute(OAuth20AccessToken.class.getName());
        val registeredService = OAuth20Utils.getRegisteredOAuthServiceByClientId(getUmaConfigurationContext().getServicesManager(),
            OAuth20Utils.getClientIdFromAuthenticatedProfile(profileResult));

        val scopes = new LinkedHashSet<>(permissionTicket.getScopes());
        scopes.add(OAuth20Constants.UMA_AUTHORIZATION_SCOPE);
        scopes.addAll(permissionTicket.getResourceSet().getScopes());
        
        val tokenRequestContext = AccessTokenRequestContext
            .builder()
            .authentication(currentAat.getAuthentication())
            .ticketGrantingTicket(currentAat.getTicketGrantingTicket())
            .grantType(OAuth20GrantTypes.UMA_TICKET)
            .responseType(OAuth20ResponseTypes.NONE)
            .registeredService(registeredService)
            .generateRefreshToken(false)
            .scopes(scopes)
            .service(currentAat.getService())
            .build();

        val result = getUmaConfigurationContext().getAccessTokenGenerator().generate(tokenRequestContext);

        val givenAccessToken = result.getAccessToken().orElseThrow();
        val accessToken = resolveAccessToken(givenAccessToken);

        val cipher = OAuth20JwtAccessTokenEncoder.toEncodableCipher(getUmaConfigurationContext(),
            registeredService, accessToken, accessToken.getService(), false);
        val encodedAccessToken = cipher.encode(accessToken.getId());
        val userProfile = OAuth20Utils.getAuthenticatedUserProfile(new JEEContext(request, response),
            getUmaConfigurationContext().getSessionStore());
        userProfile.addAttribute(UmaPermissionTicket.class.getName(), permissionTicket);
        userProfile.addAttribute(ResourceSet.class.getName(), permissionTicket.getResourceSet());

        val idTokenContext = IdTokenGenerationContext.builder()
            .accessToken(accessToken)
            .userProfile(userProfile)
            .responseType(OAuth20ResponseTypes.CODE)
            .grantType(OAuth20GrantTypes.UMA_TICKET)
            .registeredService(registeredService)
            .build();
        val idToken = getUmaConfigurationContext().getRequestingPartyTokenGenerator().generate(idTokenContext);
        accessToken.setIdToken(idToken.token());
        if (!accessToken.isStateless()) {
            getUmaConfigurationContext().getTicketRegistry().updateTicket(accessToken);
            if (StringUtils.isNotBlank(umaRequest.getRpt())) {
                getUmaConfigurationContext().getTicketRegistry().deleteTicket(umaRequest.getRpt());
            }
        }
        val model = CollectionUtils.wrap("rpt", encodedAccessToken, "code", HttpStatus.CREATED);
        return new ResponseEntity<>(model, HttpStatus.OK);
    }
Handle authorization request.

@param body     the body
@param request  the request
@param response the response
@return the response entity
support/cas-server-support-oauth-uma-core/src/main/java/org/apereo/cas/uma/web/controllers/authz/UmaAuthorizationRequestEndpointController.java