Skip to content

Commit

Permalink
LPD-20041 SamlIdpSpSession is an IDP managed model so the SP should n…
Browse files Browse the repository at this point in the history
…ot interact with it directly. We can avoid deletion of SamlSpSession and session invalidation for the paths used for SP LogoutResponse handling.
  • Loading branch information
stian-sigvartsen authored and brianchandotcom committed Mar 15, 2024
1 parent 9f876e0 commit 2ada59d
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.saml.persistence.model.SamlIdpSpSession;
import com.liferay.saml.helper.SamlHttpRequestHelper;
import com.liferay.saml.persistence.model.SamlSpSession;
import com.liferay.saml.persistence.service.SamlIdpSpSessionLocalService;
import com.liferay.saml.runtime.servlet.profile.SingleLogoutProfile;

import javax.servlet.Filter;
Expand Down Expand Up @@ -72,14 +71,15 @@ protected void doProcessFilter(
httpServletRequest);

if ((samlSpSession != null) && samlSpSession.isTerminated()) {
_singleLogoutProfile.terminateSpSession(
httpServletRequest, httpServletResponse);
String requestPath = _samlHttpRequestHelper.getRequestPath(
httpServletRequest);

SamlIdpSpSession samlIdpSpSession =
_samlIdpSpSessionLocalService.fetchSamlIdpSpSession(
samlSpSession.getSamlSpSessionId());
if (!requestPath.equals("/c/portal/logout") &&
!requestPath.equals("/c/portal/saml/slo")) {

_singleLogoutProfile.terminateSpSession(
httpServletRequest, httpServletResponse);

if (samlIdpSpSession == null) {
_singleLogoutProfile.logout(
httpServletRequest, httpServletResponse);
}
Expand All @@ -97,7 +97,7 @@ protected Log getLog() {
SpSessionTerminationSamlPortalFilter.class);

@Reference
private SamlIdpSpSessionLocalService _samlIdpSpSessionLocalService;
private SamlHttpRequestHelper _samlHttpRequestHelper;

private ServletContext _servletContext;

Expand Down

0 comments on commit 2ada59d

Please sign in to comment.