Package com.novell.ldap

Examples of com.novell.ldap.LDAPConnection.bind()


    public static SysUser getUserFromLDAP(String uid) throws EasyJException {
        LDAPConnection connection = new LDAPConnection();
        try {
            connection.connect(LDAPServerAddress, 389);
            connection.bind(LDAPConnection.LDAP_V3, "cn=admin,dc=sei,dc=pku",
                    "seiseforge");
            LDAPSearchResults rs = connection.search("uid=" + uid
                    + ",ou=People,o=SEForge,dc=sei,dc=pku",
                    LDAPConnection.SCOPE_SUB, "objectClass=*", null, false);
            SysUser user = new SysUser();
View Full Code Here


            attributeSet.add(new LDAPAttribute("sn", "snMass"));
            attributeSet.add(new LDAPAttribute("cn", "cnMass"));
            LDAPEntry entry = new LDAPEntry("uid=" + user.getUserName()
                    + ",ou=People,o=SEForge,dc=sei,dc=pku", attributeSet);
            connection.connect(LDAPServerAddress, 389);
            connection.bind(LDAPConnection.LDAP_V3, "cn=admin,dc=sei,dc=pku",
                    "seiseforge");
            connection.add(entry);
            System.out.println("成功的添加了一条记录!");
            connection.disconnect();
        } catch (Exception e) {
View Full Code Here

    public static void changePassword(SysUser user) throws EasyJException {
        LDAPConnection connection = new LDAPConnection();
        try {
            connection.connect(LDAPServerAddress, 389);
            connection.bind(LDAPConnection.LDAP_V3, "cn=admin,dc=sei,dc=pku",
                    "seiseforge");
            connection.modify("uid=" + user.getUserName()
                    + ",ou=People,o=SEForge,dc=sei,dc=pku",
                    new LDAPModification(LdapContext.REPLACE_ATTRIBUTE,
                            new LDAPAttribute("userPassword", user
View Full Code Here

          connection = new LDAPConnection();
          // connessione
          connection.connect("localhost",389);
          if (connection.isConnected()) {
            // login
            connection.bind(LDAPConnection.LDAP_V3,"cn=root,dc=spagobi,dc=com","root".getBytes("UTF8"));
            //connection.bind(3,"cn=biadmin,ou=People,dc=spagobi,dc=com","biadmin".getBytes("UTF8"));
          }
          if (connection.isBound()) {
            // valore della radice e dello scope di ricerca
            return connection;
View Full Code Here

          connection = new LDAPConnection();
          // connessione
          connection.connect("localhost",389);
          if (connection.isConnected()) {
            // login
            connection.bind(LDAPConnection.LDAP_V3,"cn="+userId+",ou=People,dc=spagobi,dc=com",psw.getBytes("UTF8"));
          }
          if (connection.isBound()) {
            return true;
          }
        }catch (LDAPException e) {
View Full Code Here

  String compsedUserId = userDn.replace("*", userId);
  try {
      connection = new LDAPConnection();
      connection.connect(host, port);
      if (connection.isConnected()) {
    connection.bind(LDAPConnection.LDAP_V3, compsedUserId, psw.getBytes("UTF8"));
      }
      if (connection.isBound()) {
    logger.debug("OUT");
    return true;
      }
View Full Code Here

  try {
      connection = new LDAPConnection();
      connection.connect(host, port);
      if (connection.isConnected()) {
    connection.bind(LDAPConnection.LDAP_V3, adminUser, (defaultCipher.decrypt(adminPsw)).getBytes("UTF8"));
      }
      if (connection.isBound()) {
    logger.debug("OUT");
    return connection;
      }
View Full Code Here

    conn = new LDAPConnection();

    conn.connect(ldapserver, ldapport);

    conn.bind(3, username, password.getBytes("UTF-8"));
    System.out.println("--" + conn.getSaslBindProperties());

    String filter = null;
    filter = "(sAMAccountName=" + i + "*)";

 
View Full Code Here

      }
      int ldapVersion = LDAPConnection.LDAP_V3;
      LDAPConnection conn = new LDAPConnection();
      conn.connect(LDAP_HOST, LDAP_PORT);
      // conn.authenticate("cn=Manager,dc=example,dc=com", "secret");
      conn.bind(ldapVersion, ROOT_DN, ROOT_PASSWORD.getBytes("utf-8"));

      System.out.println("========> create ldap entry " + EXO_DEVELOPER_DN);
      LDAPAttributeSet attributeSet = new LDAPAttributeSet();
      attributeSet.add(new LDAPAttribute("objectClass", "person"));
      attributeSet.add(new LDAPAttribute("cn", "exo"));
View Full Code Here

      }
      int ldapVersion = LDAPConnection.LDAP_V3;
      LDAPConnection conn = new LDAPConnection();
      conn.connect(LDAP_HOST, LDAP_PORT);
      // conn.authenticate("cn=Manager,dc=example,dc=com", "secret");
      conn.bind(ldapVersion, ROOT_DN, ROOT_PASSWORD.getBytes("utf-8"));

      System.out.println("========> create ldap entry " + EXO_DEVELOPER_DN);
      LDAPAttributeSet attributeSet = new LDAPAttributeSet();
      attributeSet.add(new LDAPAttribute("objectClass", "person"));
      attributeSet.add(new LDAPAttribute("cn", "exo"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.