ne.close();
}
}
} catch (NamingException e) {
e.printStackTrace();
throw new AuthenticationException(
AuthenticationException.UNNOWN_EXCEPTION,
e.getMessage());
}
if (ldapUser) {
AbstractAccount account = (AbstractAccount) getAccount(username);
if (account == null) {
Subject currentSubject = getDatabase().getSubject();
DBBroker broker = null;
try {
broker = getDatabase().get(null);
//elevate to system privs
broker.setSubject(getSecurityManager().getSystemSubject());
// account = getSecurityManager().addAccount(instantiateAccount(this, username));
account = (AbstractAccount) getSecurityManager().addAccount(new UserAider(ID, username));
} catch (Exception e) {
throw new AuthenticationException(
AuthenticationException.UNNOWN_EXCEPTION,
e.getMessage(), e);
} finally {
if(broker != null) {
broker.setSubject(currentSubject);