First parts of SAML login module

git-svn-id: https://svn.libreccm.org/ccm/trunk@6167 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2019-08-24 12:48:14 +00:00 committed by Jens Pelzetter
parent 3ff19963c9
commit 7ae48baeaf
1 changed files with 8 additions and 5 deletions

View File

@ -55,14 +55,15 @@ public class SamlLoginModule implements LoginModule {
@Override @Override
public boolean login() throws LoginException { public boolean login() throws LoginException {
final HttpServletRequest request = getRequest(); final HttpServletRequest httpRequest = getRequest();
final HttpServletResponse response = getResponse(); final HttpServletResponse httpResponse = getResponse();
final Auth auth; final Auth auth;
try { try {
auth = new Auth(request, response); auth = new Auth(OneLoginUtil.buildSettings(httpRequest),
} catch (IOException | SettingsException | Error ex) { httpRequest,
httpResponse);
} catch (SettingsException ex) {
LOGGER.error("SAML Login failed.", ex); LOGGER.error("SAML Login failed.", ex);
throw new LoginException("SAML Login failed. Configuration error?"); throw new LoginException("SAML Login failed. Configuration error?");
} }
@ -86,6 +87,7 @@ public class SamlLoginModule implements LoginModule {
@Override @Override
public boolean commit() throws LoginException { public boolean commit() throws LoginException {
if (userId != null) { if (userId != null) {
subject.getPrincipals().add(new PartyPrincipal(userId)); subject.getPrincipals().add(new PartyPrincipal(userId));
} }
@ -99,6 +101,7 @@ public class SamlLoginModule implements LoginModule {
@Override @Override
public boolean logout() throws LoginException { public boolean logout() throws LoginException {
getRequest().getSession().invalidate(); getRequest().getSession().invalidate();
return true; return true;
} }