protected ModelAndView buildCallbackViewViaRedirectUri(final AccessTokenRequestContext holder,
                                                           final Ticket code) throws Exception {
        val attributes = holder.getAuthentication().getAttributes();
        LOGGER.debug("Authorize request successful for client [{}] with redirect uri [{}]", holder.getClientId(), holder.getRedirectUri());
        val params = new LinkedHashMap<String, String>();
        params.put(OAuth20Constants.CODE, code.getId());
        CollectionUtils.firstElement(attributes.get(OAuth20Constants.STATE)).ifPresent(state -> params.put(OAuth20Constants.STATE, state.toString()));
        CollectionUtils.firstElement(attributes.get(OAuth20Constants.NONCE)).ifPresent(nonce -> params.put(OAuth20Constants.NONCE, nonce.toString()));
        LOGGER.debug("Redirecting to URL [{}] with params [{}] for clientId [{}]", holder.getRedirectUri(), params.keySet(), holder.getClientId());
        val registeredService = OAuth20Utils.getRegisteredOAuthServiceByClientId(configurationContext.getServicesManager(), holder.getClientId());
        return build(registeredService, holder.getResponseMode(), holder.getRedirectUri(), params);
    }
This is {@link OAuth20AuthorizationCodeAuthorizationResponseBuilder}.

@author Misagh Moayyed
@since 5.2.0
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/callback/OAuth20AuthorizationCodeAuthorizationResponseBuilder.java