@GetMapping(ENDPOINT_REDIRECT)
    public View redirectToProvider(final HttpServletRequest request, final HttpServletResponse response) {
        val wsfedId = request.getParameter(PARAMETER_NAME);
        try {
            val cfg = configurations.stream().filter(c -> c.getId().equals(wsfedId)).findFirst().orElse(null);
            if (cfg == null) {
                throw new IllegalArgumentException("Could not locate WsFederation configuration for " + wsfedId);
            }
            val service = determineService(request);
            val id = wsFederationHelper.getRelyingPartyIdentifier(service, cfg);
            val url = cfg.getAuthorizationUrl(id, cfg.getId());
            wsFederationCookieManager.store(request, response, cfg.getId(), service, cfg);
            return new RedirectView(url);
        } catch (final Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY);
    }
@ GetMapping ( ENDPOINT_REDIRECT ) public View redirectToProvider ( final HttpServletRequest request , final HttpServletResponse response ) { val wsfedId = request . getParameter ( PARAMETER_NAME ) ; try { val cfg = configurations . stream ( ) . filter ( c -> c . getId ( ) . equals ( wsfedId ) ) . findFirst ( ) . orElse ( null ) ; if ( cfg == null ) { throw new IllegalArgumentException ( "Could not locate WsFederation configuration for " + wsfedId ) ; } val service = determineService ( request ) ; val id = wsFederationHelper . getRelyingPartyIdentifier ( service , cfg ) ; val url = cfg . getAuthorizationUrl ( id , cfg . getId ( ) ) ; wsFederationCookieManager . store ( request , response , cfg . getId ( ) , service , cfg ) ; return new RedirectView ( url ) ; } catch ( final Exception e ) { LOGGER . error ( e . getMessage ( ) , e ) ; } throw new UnauthorizedServiceException ( UnauthorizedServiceException . CODE_UNAUTHZ_SERVICE , StringUtils . EMPTY ) ; }
Redirect to provider. Receive the client name from the request and then try to determine and build the endpoint url
for the redirection. The redirection data/url must contain a delegated client ticket id so that the request be can
restored on the trip back. SAML clients use the relay-state session attribute while others use request parameters.

@param request  the request
@param response the response
@return the view