@SneakyThrows
    protected String constructServiceUrl(final HttpServletRequest request,
                                         final HttpServletResponse response,
                                         final Pair<? extends SignableSAMLObject, MessageContext> pair) throws SamlException {
        val authnRequest = (AuthnRequest) pair.getLeft();
        val messageContext = pair.getRight();

        try (val writer = SamlUtils.transformSamlObject(samlProfileHandlerConfigurationContext.getOpenSamlConfigBean(), authnRequest)) {
            val builder = new URLBuilder(samlProfileHandlerConfigurationContext.getCallbackService().getId());
            builder.getQueryParams().add(
                new net.shibboleth.utilities.java.support.collection.Pair<>(SamlProtocolConstants.PARAMETER_ENTITY_ID,
                    SamlIdPUtils.getIssuerFromSamlObject(authnRequest)));

            val samlRequest = EncodingUtils.encodeBase64(writer.toString().getBytes(StandardCharsets.UTF_8));
            builder.getQueryParams().add(
                new net.shibboleth.utilities.java.support.collection.Pair<>(SamlProtocolConstants.PARAMETER_SAML_REQUEST,
                    samlRequest));
            builder.getQueryParams().add(
                new net.shibboleth.utilities.java.support.collection.Pair<>(SamlProtocolConstants.PARAMETER_SAML_RELAY_STATE,
                    SAMLBindingSupport.getRelayState(messageContext)));
            val url = builder.buildURL();

            LOGGER.trace("Built service callback url [{}]", url);
            return CommonUtils.constructServiceUrl(request, response,
                url, samlProfileHandlerConfigurationContext.getCasProperties().getServer().getName(),
                CasProtocolConstants.PARAMETER_SERVICE,
                CasProtocolConstants.PARAMETER_TICKET, false);
        }
    }
@ SneakyThrows protected String constructServiceUrl ( final HttpServletRequest request , final HttpServletResponse response , final Pair < ? extends SignableSAMLObject , MessageContext > pair ) throws SamlException { val authnRequest = ( AuthnRequest ) pair . getLeft ( ) ; val messageContext = pair . getRight ( ) ; try ( val writer = SamlUtils . transformSamlObject ( samlProfileHandlerConfigurationContext . getOpenSamlConfigBean ( ) , authnRequest ) ) { val builder = new URLBuilder ( samlProfileHandlerConfigurationContext . getCallbackService ( ) . getId ( ) ) ; builder . getQueryParams ( ) . add ( new net . shibboleth . utilities . java . support . collection . Pair < > ( SamlProtocolConstants . PARAMETER_ENTITY_ID , SamlIdPUtils . getIssuerFromSamlObject ( authnRequest ) ) ) ; val samlRequest = EncodingUtils . encodeBase64 ( writer . toString ( ) . getBytes ( StandardCharsets . UTF_8 ) ) ; builder . getQueryParams ( ) . add ( new net . shibboleth . utilities . java . support . collection . Pair < > ( SamlProtocolConstants . PARAMETER_SAML_REQUEST , samlRequest ) ) ; builder . getQueryParams ( ) . add ( new net . shibboleth . utilities . java . support . collection . Pair < > ( SamlProtocolConstants . PARAMETER_SAML_RELAY_STATE , SAMLBindingSupport . getRelayState ( messageContext ) ) ) ; val url = builder . buildURL ( ) ; LOGGER . trace ( "Built service callback url [{}]" , url ) ; return CommonUtils . constructServiceUrl ( request , response , url , samlProfileHandlerConfigurationContext . getCasProperties ( ) . getServer ( ) . getName ( ) , CasProtocolConstants . PARAMETER_SERVICE , CasProtocolConstants . PARAMETER_TICKET , false ) ; } }
Construct service url string.

@param request  the request
@param response the response
@param pair     the pair
@return the string
@throws SamlException the saml exception