ProxySAMLEntryPoint extends SAMLEntryPoint { @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) throws IOException, ServletException { HttpSession session = request.getSession(); LOG.info("Starting SAML redirect with session: " + (session != null ? session.getId() : "no session")); Cookie[] cookies = request.getCookies(); if (cookies == null) { LOG.info("Starting SAML redirect: there are no cookies"); } else { LOG.info("Cookies: " + Stream.of(cookies).map(c -> cookieToString(c)).collect(Collectors.joining(","))); } String clientId = request.getParameter("client_id"); if (StringUtils.hasText(clientId)) { ClientDetailsEntity clientDetails = clientDetailsEntityService.loadClientByClientId(clientId); if (clientDetails != null) { request.setAttribute(CLIENT_DETAILS, clientDetails.getClientId()); } } String forceAuthn = request.getParameter("prompt"); if (StringUtils.hasText(forceAuthn) && forceAuthn.equalsIgnoreCase("login")) { request.setAttribute(FORCE_AUTHN, true); } String idpSingleSignOn = request.getParameter("idp-single-sign-on"); if (StringUtils.hasText(idpSingleSignOn)) { request.setAttribute(IDP_SINGLE_SIGN_ON, idpSingleSignOn); } doCommence(request, response, e); }  @Override void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e); void setServiceProviderTranslationService(ServiceProviderTranslationService
                                                             serviceProviderTranslationService); void setClientDetailsEntityService(ClientDetailsEntityService clientDetailsEntityService);  }
@Test public void testCommenceSetClient() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); request.setParameter("client_id", CLIENT_ID); HttpServletResponse response = new MockHttpServletResponse(); entryPoint.commence(request, response, null); assertEquals(CLIENT_ID, request.getAttribute(CLIENT_DETAILS)); }