封裝jndi操作ldap服務(wù)器的工具類
LDAP操作封裝類
目標(biāo):使用者只需要會使用List,Map 數(shù)據(jù)結(jié)構(gòu),將對LDAP的操作進行封裝
類:主要有三個類
1 Env類 包含LDAP的連接信息
2 LdapConnectionFactory類 ldap連接工廠,提供初始化及獲取ldap連接的方法
3 LdapOperUtils ldap的處理工具類,提供了各種操作ldap的方法。
連接LDAP的連接屬性類
package com.common.ldapconnection;
import org.apache.log4j.Logger;
/**
* <p>功能描述:連接LDAP的連接屬性</p>
* @author liaowufeng
* @version 1.0
*/
public class Env {
// 調(diào)用log4j的日志,用于輸出
private Logger log = Logger.getLogger(Env.class.getName());
// 無論用什么LDAP服務(wù)器的固定寫法,指定了JNDI服務(wù)提供者中工廠類
public String factory ;
// 服務(wù)連接地址
public String url ;
// 登陸LDAP的用戶名和密碼
public String adminUID ;
// 登陸LDAP用戶密碼
public String adminPWD ;
// 安全訪問需要的證書庫
public String sslTrustStore;
// 安全通道訪問
public String securityProtocol ;
// 連接TimeOut
public String timeOut;
/**
* 構(gòu)造函數(shù)
*/
public Env() {
}
/**
* 構(gòu)造函數(shù)
* @param factory LDAP工廠類
* @param url LDAP URL
* @param adminUID LDAP 用戶
* @param adminPWD LDAP 密碼
*/
public Env(String factory, String url, String adminUID, String adminPWD) {
this.factory = factory;
this.url = url;
this.adminUID = adminUID;
this.adminPWD = adminPWD;
}
/**
* 構(gòu)造函數(shù)
* @param factory LDAP 工廠類名
* @param url LDAP URL
* @param adminUID LDAP 用戶
* @param adminPWD LDAP 密碼
* @param sslTrustStore 安全訪問需要的證書
* @param securityProtocol 安全通道訪問
*/
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;
}
/**
* 構(gòu)造函數(shù)
* @param factory LDAP 工廠類名
* @param url LDAP URL
* @param adminUID LDAP 用戶
* @param adminPWD LDAP 密碼
* @param sslTrustStore 安全訪問需要的證書
* @param securityProtocol 安全通道訪問
*/
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;
}
}
相關(guān)文章
使用GSON庫轉(zhuǎn)換Java對象為JSON對象的進階實例詳解
這篇文章主要介紹了使用GSON庫轉(zhuǎn)換Java對象為JSON對象的進階實例詳解,包括注冊TypeAdapter及處理Enum類型等實際運用中可能遇到的一些復(fù)雜問題,需要的朋友可以參考下2016-06-06
thymeleaf中前后端數(shù)據(jù)交互方法匯總
這篇文章主要介紹了thymeleaf中前后端數(shù)據(jù)交互小結(jié),本文通過示例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友參考下吧2022-07-07
Java實現(xiàn)數(shù)據(jù)脫敏(Desensitization)的操作指南
數(shù)據(jù)脫敏是指通過對敏感數(shù)據(jù)進行部分或完全隱藏處理,保護敏感信息在存儲和使用過程中的安全性,常見的應(yīng)用場景包括日志記錄、接口返回、報表展示、數(shù)據(jù)分析等,本文給大家介紹了Java實現(xiàn)數(shù)據(jù)脫敏(Desensitization)的操作指南,需要的朋友可以參考下2025-02-02
Java 客戶端向服務(wù)端上傳mp3文件數(shù)據(jù)的實例代碼
這篇文章主要介紹了Java 客戶端向服務(wù)端上傳mp3文件數(shù)據(jù)的實例代碼,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下2018-09-09

