Package io.jmix.saml.logout
Class SamlVaadinLogoutSuccessHandler
java.lang.Object
io.jmix.saml.logout.SamlVaadinLogoutSuccessHandler
- All Implemented Interfaces:
org.springframework.security.web.authentication.logout.LogoutSuccessHandler
@NullMarked
public class SamlVaadinLogoutSuccessHandler
extends Object
implements org.springframework.security.web.authentication.logout.LogoutSuccessHandler
A
LogoutSuccessHandler that issues a SAML 2.0 LogoutRequest to the asserting party and is aware of
Vaadin UIDL requests. It is used instead of Saml2RelyingPartyInitiatedLogoutSuccessHandler because:
- Vaadin
AuthenticationContext.logout()invokes the logout success handler within a UIDL (XHR) request where a plain HTTP redirect does not navigate the browser. This handler usesUidlRedirectStrategywhich performs a client-side page location change for UIDL requests and falls back to a regular redirect otherwise. Saml2LogoutResponseFilterinvokes the logout success handler withnullauthentication after processing the LogoutResponse from the asserting party. This handler redirects tologoutSuccessUrlin that case instead of responding with 401.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestRepositoryprotected final org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestResolverprotected Stringprotected org.springframework.security.web.RedirectStrategy -
Constructor Summary
ConstructorsConstructorDescriptionSamlVaadinLogoutSuccessHandler(org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestResolver logoutRequestResolver) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcreateSamlPostRequestFormData(String location, String saml, @Nullable String relayState) Renders the same auto-submitting form asSaml2RelyingPartyInitiatedLogoutSuccessHandlerdoes for the POST binding.protected voiddoPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.saml2.provider.service.authentication.logout.Saml2LogoutRequest logoutRequest) protected voiddoRedirect(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.saml2.provider.service.authentication.logout.Saml2LogoutRequest logoutRequest) protected booleanisUidlRequest(jakarta.servlet.http.HttpServletRequest request) voidonLogoutSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @Nullable org.springframework.security.core.Authentication authentication) voidsetLogoutRequestRepository(org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestRepository logoutRequestRepository) Sets theSaml2LogoutRequestRepositoryfor saving the SAML LogoutRequest.voidsetLogoutSuccessUrl(String logoutSuccessUrl) Sets the URL to redirect to when the SAML LogoutRequest cannot be generated or the single logout has completed.voidsetRedirectStrategy(org.springframework.security.web.RedirectStrategy redirectStrategy)
-
Field Details
-
logoutRequestResolver
protected final org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestResolver logoutRequestResolver -
logoutRequestRepository
protected org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestRepository logoutRequestRepository -
redirectStrategy
protected org.springframework.security.web.RedirectStrategy redirectStrategy -
logoutSuccessUrl
-
-
Constructor Details
-
SamlVaadinLogoutSuccessHandler
public SamlVaadinLogoutSuccessHandler(org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestResolver logoutRequestResolver)
-
-
Method Details
-
onLogoutSuccess
public void onLogoutSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @Nullable org.springframework.security.core.Authentication authentication) throws IOException - Specified by:
onLogoutSuccessin interfaceorg.springframework.security.web.authentication.logout.LogoutSuccessHandler- Throws:
IOException
-
setLogoutSuccessUrl
Sets the URL to redirect to when the SAML LogoutRequest cannot be generated or the single logout has completed. The URL is resolved against the servlet context path for regular requests; for UIDL requests it is passed to the browser as is, so use an absolute URL if the application is deployed under a non-root context path. -
setLogoutRequestRepository
public void setLogoutRequestRepository(org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestRepository logoutRequestRepository) Sets theSaml2LogoutRequestRepositoryfor saving the SAML LogoutRequest. It must match the repository used bySaml2LogoutResponseFilterto validate the LogoutResponse. -
setRedirectStrategy
public void setRedirectStrategy(org.springframework.security.web.RedirectStrategy redirectStrategy) -
doRedirect
protected void doRedirect(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.saml2.provider.service.authentication.logout.Saml2LogoutRequest logoutRequest) throws IOException - Throws:
IOException
-
doPost
protected void doPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.saml2.provider.service.authentication.logout.Saml2LogoutRequest logoutRequest) throws IOException - Throws:
IOException
-
isUidlRequest
protected boolean isUidlRequest(jakarta.servlet.http.HttpServletRequest request) -
createSamlPostRequestFormData
protected String createSamlPostRequestFormData(String location, String saml, @Nullable String relayState) Renders the same auto-submitting form asSaml2RelyingPartyInitiatedLogoutSuccessHandlerdoes for the POST binding.
-