Tool Class 1 for encapsulating JNDI operations on LDAP Servers

Source: Internet
Author: User
LDAP operation encapsulation class

Author: Liao Wufeng
MSN: liaowufeng1111@hotmail.com
QQ: 38773367
Email: moaihe1111@163.com

I am the author's original. If you resend the post, please keep the author's signature. Thank you!

LDAP operation encapsulation class

Target: users only need to use the list and map data structures to encapsulate LDAP operations.
Class: There are three main types
1 env class contains LDAP connection information
2 ldapconnectionfactory LDAP connection factory, provides methods for initializing and obtaining LDAP connections
3 ldapoperutils the LDAP processing tool class provides various LDAP operations.

Connection attribute class for connecting to LDAP

Java code
Package COM. common. ldapconnection; import Org. apache. log4j. logger;/*** <p> function description: connect to the LDAP connection attribute </P> * @ author liaowufeng * @ version 1.0 */public class env {// call the log4j log to output private logger log = logger. getlogger (Env. class. getname (); // no matter which LDAP server is used, the factory class public string factory in the JNDI service provider is specified; // The Public String URL of the service connection address; // log on to the LDAP user name and password Public String adminuid; // log on to the LDAP User Password Public String adminpwd; // securely access the required certificate library Public String ssltruststore; // Security Channel Access Public String securityprotocol; // connection timeout Public String timeout;/*** constructor */Public ENV () {}/*** constructor * @ Param factory LDAP factory class * @ Param url ldap url * @ Param adminuid LDAP user * @ Param adminpwd LDAP password */Public ENV (string factory, string URL, string adminuid, string adminpwd) {This. factory = factory; this. url = URL; this. adminuid = adminuid; this. adminpwd = adminpwd ;} /*** constructor ** @ Param factory LDAP factory class name * @ Param url ldap url * @ Param adminuid LDAP user * @ Param adminpwd LDAP password * @ Param ssltruststore required for secure access certificate * @ Param securityprotocol Secure Channel Access */Public ENV (string factory, string URL, string adminuid, string adminpwd, string ssltruststore, string securityprotocol) {This. factory = factory; this. url = URL; this. adminuid = adminuid; this. adminpwd = adminpwd; this. ssltruststore = ssltruststore; this. securityprotocol = securityprotocol ;} /*** constructor ** @ Param factory LDAP factory class name * @ Param url ldap url * @ Param adminuid LDAP user * @ Param adminpwd LDAP password * @ Param ssltruststore required for secure access certificate * @ Param securityprotocol Secure Channel Access */Public ENV (string factory, string URL, string adminuid, string adminpwd, string timeout, string ssltruststore, string securityprotocol) {This. factory = factory; this. url = URL; this. adminuid = adminuid; this. adminpwd = adminpwd; this. timeout = timeout; this. ssltruststore = ssltruststore; this. securityprotocol = securityprotocol ;}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.