showWarning("disclaimer.form.cancelled");
}
}
public static Identity authenticate(String username, String pwd, LDAPError ldapError) {
LDAPLoginManager ldapManager = LDAPLoginManager.getInstance();
Attributes attrs = ldapManager.bindUser(username, pwd, ldapError);
if (ldapError.isEmpty() && attrs != null) {
Identity identity = ldapManager.findIdentyByLdapAuthentication(username, ldapError);
if (!ldapError.isEmpty()) return null;
if (identity == null) {
// User authenticated but not yet existing - create as new OLAT user
ldapManager.createAndPersistUser(attrs);
identity = ldapManager.findIdentyByLdapAuthentication(username, ldapError);
} else {
// User does already exist - just sync attributes
Map<String, String> olatProToSync = ldapManager.prepareUserPropertyForSync(attrs, identity);
if (olatProToSync != null) {
ldapManager.syncUser(olatProToSync, identity);
}
}
// Add or update an OLAT authentication token for this user if configured in the module
if (identity != null && LDAPLoginModule.isCacheLDAPPwdAsOLATPwdOnLogin()) {
Manager secMgr = ManagerFactory.getManager();