JAVA操作LDAP之创建用户篇

为什么80%的码农都做不了架构师?>>>   hot3.png

 int UF_ACCOUNTDISABLE = 0x0002;
         int UF_PASSWD_NOTREQD = 0x0020;
         int UF_PASSWD_CANT_CHANGE = 0x0040;
         int UF_NORMAL_ACCOUNT = 0x0200;
         int UF_DONT_EXPIRE_PASSWD = 0x10000;
         int UF_PASSWORD_EXPIRED = 0x800000;

Attributes attributes = new BasicAttributes(true);
            Attribute attribute = new BasicAttribute("objectclass");
            attribute.add("top");
            attribute.add("person");
            attribute.add("user");
            attributes.put(attribute);
            attributes.put("mail", "[email protected]");
            attributes.put("description", "12345");
            attributes.put("telephoneNumber", "13012344321");
            attributes.put("sAMAccountName", "zhangsan");
            attributes.put("cn", "张三");
            attributes.put("sn", "张");
            attributes.put("givenName", "三");
            attributes.put("userPrincipalName", "[email protected]");
            attributes.put("userAccountControl", Integer.toString(UF_DONT_EXPIRE_PASSWD+UF_NORMAL_ACCOUNT+UF_PASSWD_NOTREQD));
            context.createSubcontext("CN=张三,CN=Users,DC=umapad,DC=com", attributes);

转载于:https://my.oschina.net/haison/blog/677835

你可能感兴趣的:(JAVA操作LDAP之创建用户篇)