• 大小: 4.09MB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-09-27
  • 语言: Java
  • 标签: LDAP  JAVA  SSL  

资源简介

java连接LDAP实例和jar包,里面包含ssl连接和更改LDAP属性的例子,公参考

资源截图

代码片段和文件信息

/*******************************************************************************
 * $Novell: AddEntry.javav 1.15 2003/08/21 11:28:45 $
 * Copyright (c) 2000-2003 Novell Inc. All Rights Reserved.
 *
 * THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
 * TREATIES. USE AND REDISTRIBUTION OF THIS WORK IS SUBJECT TO THE LICENSE
 * AGREEMENT ACCOMPANYING THE SOFTWARE DEVELOPMENT KIT (SDK) THAT CONTAINS
 * THIS WORK. PURSUANT TO THE SDK LICENSE AGREEMENT NOVELL HEREBY GRANTS TO
 * DEVELOPER A ROYALTY-FREE NON-EXCLUSIVE LICENSE TO INCLUDE NOVELL‘S SAMPLE
 * CODE IN ITS PRODUCT. NOVELL GRANTS DEVELOPER WORLDWIDE DISTRIBUTION RIGHTS
 * TO MARKET DISTRIBUTE OR SELL NOVELL‘S SAMPLE CODE AS A COMPONENT OF
 * DEVELOPER‘S PRODUCTS. NOVELL SHALL HAVE NO OBLIGATIONS TO DEVELOPER OR
 * DEVELOPER‘S CUSTOMERS WITH RESPECT TO THIS CODE.
 *
 * $name:         AddEntry.java 
 * $description:  AddEntry adds an entry to the directory. First it creates
 *                each attribute of the entry adds it to the attribute
 *                set and then uses the DN and the newly created attribute
 *                set to create an LDAPEntry entry newEntry. Finally it calls
 *                the LDAPConnection add method to add the entry into the
 *                directory.
 ******************************************************************************/

import com.novell.ldap.LDAPAttribute;
import com.novell.ldap.LDAPAttributeSet;
import com.novell.ldap.LDAPEntry;
import com.novell.ldap.LDAPConnection;
import com.novell.ldap.LDAPException;
import java.io.UnsupportedEncodingException;

public class AddEntry
{
    public static void main( String[] args )
    {
        if (args.length != 4) {
            System.err.println(“Usage:   java AddEntry  
                                                + “  “);
            System.err.println(“Example: java AddEntry Acme.com“
                        + “ \“cn=admino=Acme\“ secret \“ou=Saleso=Acme\““);
            System.exit(1);
        }
                
        int ldapPort = LDAPConnection.DEFAULT_PORT;
        int ldapVersion  = LDAPConnection.LDAP_V3;
        String ldapHost       = args[0];
        String loginDN        = args[1];
        String password       = args[2];
        String containerName  = args[3];
        LDAPConnection lc = new LDAPConnection();
        LDAPAttribute  attribute = null;
        LDAPAttributeSet attributeSet = new LDAPAttributeSet();

     
        /* To Add an entry to the directory
         *  - Create the attributes of the entry and add them to an attribute set
         *  - Specify the DN of the entry to be created
         *  - Create an LDAPEntry object with the DN and the attribute set
         *  - Call the LDAPConnection add method to add it to the directory
         */                   
        attributeSet.add( new LDAPAttribute( 
                          

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-11-21 06:14  novell-jldap-devel-2013.08.30.1433-xplat\
     目录           0  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\bin\
     文件        1464  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\bin\jldaprootdse.bat
     文件        1111  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\bin\jldaprootdse
     文件        1118  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\bin\jldapschema
     文件        1114  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\bin\jldapsearch
     文件        1467  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\bin\jldapsearch.bat
     文件         967  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\bin\getpath.bat
     文件        1122  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\bin\jldappassword
     文件        1471  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\bin\jldapschema.bat
     文件        1475  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\bin\jldappassword.bat
     目录           0  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\lib\
     文件      432436  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\lib\ldap.jar
     文件       44107  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\lib\utilities.jar
     目录           0  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\wars\
     文件      579337  2009-10-16 15:53  novell-jldap-devel-2013.08.30.1433-xplat\wars\dsmlstream.war
     文件     2303152  2009-10-16 15:53  novell-jldap-devel-2013.08.30.1433-xplat\wars\dsmldom.war
     文件        2033  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\LICENSE
     目录           0  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\
     文件        4326  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\SetPassword.java
     文件        5882  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\UrlSearch.java
     文件        5637  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\LDAPSchemaDSMLSerialization.java
     文件       20448  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\GetDSE.java
     文件        3587  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\VerifyPassword.java
     文件        8252  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\ModifyAttrs.java
     文件       14325  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\ExtendSchema.java
     文件        9348  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\ModifyTimeStamp.java
     文件        5614  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\MD5Bind.java
     目录           0  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\dsml_consumers\
     文件        1678  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\dsml_consumers\DsmlClient.java
     文件        3776  2013-08-30 09:03  novell-jldap-devel-2013.08.30.1433-xplat\samples\dsml_consumers\LDAPOperation.java
............此处省略101个文件信息

评论

共有 条评论