protected Optional<RedirectionAction> build(final CasClient casClient, final WebContext context,
        final boolean renew, final boolean gateway) {
        val serviceUrl = casClient.computeFinalCallbackUrl(context);
        val casServerLoginUrl = casClient.getConfiguration().getLoginUrl();
        val redirectionUrl = casServerLoginUrl + (casServerLoginUrl.contains("?") ? "&" : "?")
            + CasProtocolConstants.PARAMETER_SERVICE + '=' + EncodingUtils.urlEncode(serviceUrl)
            + (renew ? '&' + CasProtocolConstants.PARAMETER_RENEW + "=true" : StringUtils.EMPTY)
            + (gateway ? '&' + CasProtocolConstants.PARAMETER_GATEWAY + "=true" : StringUtils.EMPTY);
        LOGGER.debug("Final redirect url is [{}]", redirectionUrl);
        return Optional.of(new FoundAction(redirectionUrl));
    }
Build with predefined renew and gateway parameters.

@param casClient the cas client config
@param context   the context
@param renew     ask for credentials again
@param gateway   skip asking for credentials
@return the redirect action
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/OAuth20DefaultCasClientRedirectActionBuilder.java