Some bugfixes for the JndiLoginModule

git-svn-id: https://svn.libreccm.org/ccm/trunk@6270 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2019-10-17 17:35:54 +00:00
parent 3973c56df8
commit a6ffe42ec1
1 changed files with 14 additions and 16 deletions

View File

@ -105,7 +105,7 @@ public class JndiLoginModule extends PasswordLoginModule implements LoginModule
userAuthentication = UserAuthentication userAuthentication = UserAuthentication
.retrieveForSSOlogin(getUsername()); .retrieveForSSOlogin(getUsername());
} catch (DataObjectNotFoundException ex) { } catch (DataObjectNotFoundException ex) {
return false; throw new FailedLoginException("User not found in LDAP.");
} }
final boolean result = super.login(); final boolean result = super.login();
return result; return result;
@ -115,12 +115,10 @@ public class JndiLoginModule extends PasswordLoginModule implements LoginModule
public boolean commit() throws LoginException { public boolean commit() throws LoginException {
LOGGER.debug("Commit"); LOGGER.debug("Commit");
if (userAuthentication == null) { if (userAuthentication != null) {
return false;
}
final BigDecimal userId = userAuthentication.getUser().getID(); final BigDecimal userId = userAuthentication.getUser().getID();
subject.getPrincipals().add(new PartyPrincipal(userId)); subject.getPrincipals().add(new PartyPrincipal(userId));
}
return true; return true;
} }
@ -128,18 +126,18 @@ public class JndiLoginModule extends PasswordLoginModule implements LoginModule
@Override @Override
public boolean abort() throws LoginException { public boolean abort() throws LoginException {
LOGGER.debug("Aborting"); LOGGER.debug("Aborting");
if (userAuthentication == null) { // if (userAuthentication == null) {
return false; // return false;
} // }
return true; return true;
} }
@Override @Override
public boolean logout() throws LoginException { public boolean logout() throws LoginException {
LOGGER.debug("Logout"); LOGGER.debug("Logout");
if (userAuthentication == null) { // if (userAuthentication == null) {
return false; // return false;
} // }
return true; return true;
} }