Examples of LDAPAttribute


Examples of com.novell.ldap.LDAPAttribute

    public static void addUserToLDAP(SysUser user) throws EasyJException {
        LDAPConnection connection = new LDAPConnection();
        try {
            LDAPAttributeSet attributeSet = new LDAPAttributeSet();

            attributeSet.add(new LDAPAttribute("objectclass", new String[] {
                "pilotPerson", "uidObject"
            }));
            attributeSet.add(new LDAPAttribute("uid", user.getUserName()));
            attributeSet.add(new LDAPAttribute("userPassword", user
                    .getPassword()));
            attributeSet.add(new LDAPAttribute("mail", user.getEmail()));
            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");
View Full Code Here

Examples of com.novell.ldap.LDAPAttribute

            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
                                    .getPassword())));
            System.out.println("成功修改一条记录!");
            connection.disconnect();
        } catch (LDAPException e) {
            e.printStackTrace();
View Full Code Here

Examples of netscape.ldap.LDAPAttribute

            connection.bind(_authid, _authpw );
         
          //change attribut         
            connection.modify( base,
              new LDAPModification(LDAPModification.REPLACE,
                  new LDAPAttribute( attrKey, value)));
          return true;
        } catch( LDAPException e1) {
          throw new Exception ("..can not change the Key. " + attrKey + "=" + value + " " + e1.toString());                  
        }
       
View Full Code Here

Examples of netscape.ldap.LDAPAttribute

                        //System.out.println("attribute 1 = "+set);
                        System.out.println("");

                        Enumeration enumAttrs = set.getAttributes();
                        while ( enumAttrs.hasMoreElements() ) {
                            LDAPAttribute anAttr = (LDAPAttribute)enumAttrs.nextElement();
                            String attrName = anAttr.getName();
                  
                            System.out.print( attrName );
                  
                            Enumeration enumVals = anAttr.getStringValues();
                  
                            if(enumVals != null){
                                while ( enumVals.hasMoreElements() ) {
                                    String aVal = ( String )enumVals.nextElement();
                                    System.out.println( "\t" + aVal );
View Full Code Here

Examples of netscape.ldap.LDAPAttribute

    {
  props.put(prefix + "dn", entry.getDN());
  if (names == null) {
      Enumeration e = entry.getAttributeSet().getAttributes();
      while (e.hasMoreElements()) {
    LDAPAttribute attr = (LDAPAttribute) e.nextElement();
    props.put(prefix + attr.getName(), getAttributeValue(attr));
      }
  } else {
      for (int i = 0; i < names.length; i++) {
    LDAPAttribute attr = entry.getAttribute(names[i]);
    String value = (attr == null) ? "" : getAttributeValue(attr);
    props.put(prefix + names[i], value);
      }
  }
    }
View Full Code Here

Examples of netscape.ldap.LDAPAttribute

                String add = hr.get("add");

                System.out.println(add);

                LDAPAttributeSet attrs = new LDAPAttributeSet();
                LDAPAttribute attr = new LDAPAttribute("objectclass");

                for (int i = 0; i < objectclass_values.length; i++) {
                    attr.addValue(objectclass_values[i]);
                }

                attrs.add(attr);

                // The add string will look like this: cn=x,y|sn=u,z|x3=p...
View Full Code Here

Examples of netscape.ldap.LDAPAttribute

     *
     * @see
     */
    public void addattrs(String s, Object attrs, String actions[]) {
        StringTokenizer st = new StringTokenizer(s, "|");
    LDAPAttribute attr = null;
    int index = 0;

        while (st.hasMoreTokens()) {
            StringTokenizer ts = new StringTokenizer(st.nextToken(), "=,");

            attr = new LDAPAttribute(ts.nextToken());

            while (ts.hasMoreTokens()) {
                attr.addValue(ts.nextToken());
            }

            System.out.println("Add:" + attr);

            if (attrs instanceof LDAPModificationSet) {
View Full Code Here

Examples of netscape.ldap.LDAPAttribute

        if (names == null) {
            Enumeration e = entry.getAttributeSet().getAttributes();

            while (e.hasMoreElements()) {
                LDAPAttribute attr = (LDAPAttribute) e.nextElement();

                props.put(prefix + attr.getName(), getAttributeValue(attr));
            }
        } else {
            for (int i = 0; i < names.length; i++) {
                LDAPAttribute attr = entry.getAttribute(names[i]);
                String value = (attr == null) ? "" : getAttributeValue(attr);

                props.put(prefix + names[i], value);
            }
        }
View Full Code Here

Examples of netscape.ldap.LDAPAttribute

        constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
        conn.setConstraints( constraints );
       
        // add success
        LDAPAttributeSet attrSet = new LDAPAttributeSet();
        attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
        attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
        LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", attrSet );
       
        try
        {
            conn.add( entry, constraints );
View Full Code Here

Examples of netscape.ldap.LDAPAttribute

        LDAPConstraints constraints = new LDAPConstraints();
        conn.setConstraints( constraints );

        // referrals failure
        LDAPAttributeSet attrSet = new LDAPAttributeSet();
        attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
        attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
        LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,ou=Computers,uid=akarasuluref,ou=users,ou=system", attrSet );
       
        LDAPResponseListener listener = conn.add( entry, null, constraints );
        LDAPResponse response = listener.getResponse();
        assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
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.