From 7ae48baeaf156167f3aa0823f5bd8a77a127a525 Mon Sep 17 00:00:00 2001 From: jensp Date: Sat, 24 Aug 2019 12:48:14 +0000 Subject: [PATCH] First parts of SAML login module git-svn-id: https://svn.libreccm.org/ccm/trunk@6167 8810af33-2d31-482b-a856-94f89814c4df --- .../arsdigita/kernel/security/SamlLoginModule.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ccm-core/src/com/arsdigita/kernel/security/SamlLoginModule.java b/ccm-core/src/com/arsdigita/kernel/security/SamlLoginModule.java index a65451e79..bd0e12ca0 100644 --- a/ccm-core/src/com/arsdigita/kernel/security/SamlLoginModule.java +++ b/ccm-core/src/com/arsdigita/kernel/security/SamlLoginModule.java @@ -55,14 +55,15 @@ public class SamlLoginModule implements LoginModule { @Override public boolean login() throws LoginException { - final HttpServletRequest request = getRequest(); - final HttpServletResponse response = getResponse(); + final HttpServletRequest httpRequest = getRequest(); + final HttpServletResponse httpResponse = getResponse(); final Auth auth; try { - auth = new Auth(request, response); - } catch (IOException | SettingsException | Error ex) { - + auth = new Auth(OneLoginUtil.buildSettings(httpRequest), + httpRequest, + httpResponse); + } catch (SettingsException ex) { LOGGER.error("SAML Login failed.", ex); throw new LoginException("SAML Login failed. Configuration error?"); } @@ -86,6 +87,7 @@ public class SamlLoginModule implements LoginModule { @Override public boolean commit() throws LoginException { + if (userId != null) { subject.getPrincipals().add(new PartyPrincipal(userId)); } @@ -99,6 +101,7 @@ public class SamlLoginModule implements LoginModule { @Override public boolean logout() throws LoginException { + getRequest().getSession().invalidate(); return true; }