Package org.olat.ldap

Examples of org.olat.ldap.LDAPLoginManager


      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();
View Full Code Here

TOP

Related Classes of org.olat.ldap.LDAPLoginManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.