mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-14 12:32:09 +08:00
org.dromara.maxkey.ldap
This commit is contained in:
@@ -55,8 +55,6 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.crypto.password.Pbkdf2PasswordEncoder;
|
||||
import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder;
|
||||
|
||||
import com.nimbusds.jose.JOSEException;
|
||||
|
||||
@AutoConfiguration
|
||||
public class ApplicationAutoConfiguration implements InitializingBean {
|
||||
static final Logger _logger = LoggerFactory.getLogger(ApplicationAutoConfiguration.class);
|
||||
|
||||
@@ -1,237 +0,0 @@
|
||||
/*
|
||||
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.dromara.maxkey.constants.ldap;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* ActiveDirectoryUser objectclass attribute
|
||||
* top -> person -> organizationalPerson -> user
|
||||
* @author shimingxy
|
||||
*
|
||||
*/
|
||||
|
||||
public class ActiveDirectoryUser {
|
||||
public static ArrayList<String> OBJECTCLASS = new ArrayList<>(Arrays.asList("top", "person", "organizationalPerson", "user"));
|
||||
|
||||
public static String objectClass = "user";
|
||||
/** userAccountControl值得说明
|
||||
* http://support.microsoft.com/zh-cn/kb/305144
|
||||
* https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/useraccountcontrol-manipulate-account-properties
|
||||
*/
|
||||
public static class userAccountControl{
|
||||
//Property flag Value in hexadecimal Value in decimal
|
||||
public static final int SCRIPT =0x0001 ;// 1
|
||||
public static final int ACCOUNTDISABLE =0x0002 ;// 2
|
||||
public static final int HOMEDIR_REQUIRED =0x0008 ;// 8
|
||||
public static final int LOCKOUT =0x0010 ;// 16
|
||||
public static final int PASSWD_NOTREQD =0x0020 ;// 32
|
||||
public static final int PASSWD_CANT_CHANGE =0x0040 ;// 64 You can't assign this permission by directly modifying the UserAccountControl attribute. For information about how to set the permission programmatically, see the Property flag descriptions section.
|
||||
public static final int ENCRYPTED_TEXT_PWD_ALLOWED =0x0080 ;// 128
|
||||
public static final int TEMP_DUPLICATE_ACCOUNT =0x0100 ;// 256
|
||||
public static final int NORMAL_ACCOUNT =0x0200 ;// 512
|
||||
public static final int INTERDOMAIN_TRUST_ACCOUNT =0x0800 ;// 2048
|
||||
public static final int WORKSTATION_TRUST_ACCOUNT =0x1000 ;// 4096
|
||||
public static final int SERVER_TRUST_ACCOUNT =0x2000 ;// 8192
|
||||
public static final int DONT_EXPIRE_PASSWORD =0x10000 ;// 65536
|
||||
public static final int MNS_LOGON_ACCOUNT =0x20000 ;// 131072
|
||||
public static final int SMARTCARD_REQUIRED =0x40000 ;// 262144
|
||||
public static final int TRUSTED_FOR_DELEGATION =0x80000 ;// 524288
|
||||
public static final int NOT_DELEGATED =0x100000 ;// 1048576
|
||||
public static final int USE_DES_KEY_ONLY =0x200000 ;// 2097152
|
||||
public static final int DONT_REQ_PREAUTH =0x400000 ;// 4194304
|
||||
public static final int PASSWORD_EXPIRED =0x800000 ;// 8388608
|
||||
public static final int TRUSTED_TO_AUTH_FOR_DELEGATION =0x1000000 ;// 16777216
|
||||
public static final int PARTIAL_SECRETS_ACCOUNT =0x04000000 ;// 67108864
|
||||
}
|
||||
|
||||
/*
|
||||
*常规
|
||||
* 名 First Name givenName
|
||||
* 姓 Last Name/SurName sn
|
||||
* 英文缩写 Initials initials
|
||||
* 描述 Description description
|
||||
* 办公室 Office physicalDeliveryOfficeName
|
||||
* 电话号码 Telephone Number telephoneNumber
|
||||
* 电话号码 Telephone: Other otherTelephone
|
||||
* 电子邮件 E-Mail mail
|
||||
* 网页 Web Page wwwHomePage
|
||||
* Web Page: Other url
|
||||
*
|
||||
* 家庭电话 Home telephoneNumber
|
||||
* Home: Other otherTelephone
|
||||
* 寻呼机 Pager pager
|
||||
* Pager: Other pagerOther
|
||||
* 移动电话 Mobile mobile
|
||||
* Mobile: Other otherMobile
|
||||
* 传真 Fax facsimileTelephoneNumber
|
||||
* Fax: Other otherFacsimileTelephoneNumber
|
||||
* IP电话 IP phone ipPhone
|
||||
* IP phone: Other otherIpPhone
|
||||
* 注释 Notes info
|
||||
*帐号
|
||||
* 用户登录名 UserLogon Name userPrincipalName
|
||||
* 用户登录名(以前版本)User logon name (pre-Windows 2000) sAMAccountname
|
||||
* 登录时间 Logon Hours logonHours
|
||||
* 登录到 Log On To logonWorkstation
|
||||
* 用户帐户控制 Account is locked out userAccountControl (启用:512,禁用:514, 密码永不过期:66048)
|
||||
* Other Account Options userAccountControl
|
||||
* User must change password at next logon pwdLastSet
|
||||
* User cannot change password N/A
|
||||
* 帐户过期 Account Expires accountExpires
|
||||
*
|
||||
*地址
|
||||
* 街道 Street streetAddress
|
||||
* 邮政信箱 P.O.Box postOfficeBox
|
||||
* 邮政编码 Zip/Postal Code postalCode
|
||||
* 市/县 City l
|
||||
* 省/自治区 State/Province st
|
||||
* 国家/地区 Country/Region c,co, and countryCode
|
||||
*
|
||||
*单位
|
||||
* 职务 Title title
|
||||
* 部门 Department department
|
||||
* 公司 Company company
|
||||
* 经理 Manager:Name manager
|
||||
* 直接汇报人 Direct Reports directReports
|
||||
*
|
||||
*成员
|
||||
* 成员组 Member of memberOf
|
||||
* 主要组 Set Primary Group primaryGroupID
|
||||
*/
|
||||
|
||||
public static final String CN = "cn";
|
||||
public static final String NAME = "name";
|
||||
public static final String UID = "uid";
|
||||
|
||||
/**
|
||||
* First Name
|
||||
*/
|
||||
public static final String GIVENNAME = "givenName";
|
||||
/**
|
||||
* Last Name/SurName
|
||||
*/
|
||||
public static final String SN = "sn";
|
||||
public static final String INITIALS = "initials";
|
||||
public static final String DESCRIPTION = "description";
|
||||
public static final String PHYSICALDELIVERYOFFICENAME = "physicalDeliveryOfficeName";
|
||||
public static final String MAIL = "mail";
|
||||
public static final String WWWHOMEPAGE = "wwwHomePage";
|
||||
public static final String DISPLAYNAME = "displayName";
|
||||
|
||||
public static final String TELEPHONENUMBER = "telephoneNumber";
|
||||
public static final String OTHERTELEPHONE = "otherTelephone";
|
||||
public static final String PAGER = "pager";
|
||||
public static final String PAGEROTHER = "pagerOther";
|
||||
public static final String MOBILE = "mobile";
|
||||
public static final String OTHERMOBILE = "otherMobile";
|
||||
public static final String FACSIMILETELEPHONENUMBER = "facsimileTelephoneNumber";
|
||||
public static final String OTHERFACSIMILETELEPHONENUMBER = "otherFacsimileTelephoneNumber";
|
||||
public static final String IPPHONE = "ipPhone";
|
||||
public static final String OTHERIPPHONE = "otherIpPhone";
|
||||
public static final String INFO = "info";
|
||||
public static final String HOMEPHONE = "homePhone";
|
||||
|
||||
/**
|
||||
* admin@maxkey.top
|
||||
*/
|
||||
public static final String USERPRINCIPALNAME = "userPrincipalName";
|
||||
/**
|
||||
* maxkey\admin
|
||||
*/
|
||||
public static final String SAMACCOUNTNAME = "sAMAccountname";
|
||||
public static final String LOGONHOURS = "logonHours";
|
||||
public static final String LOGONWORKSTATION = "logonWorkstation";
|
||||
public static final String USERACCOUNTCONTROL = "userAccountControl";
|
||||
public static final String PWDLASTSET = "pwdLastSet";
|
||||
public static final String ACCOUNTEXPIRES = "accountExpires";
|
||||
|
||||
public static final String CO = "co";
|
||||
public static final String C = "c";
|
||||
public static final String COUNTRYCODE = "countryCode";
|
||||
public static final String ST = "st";
|
||||
public static final String L = "l";
|
||||
public static final String STREETADDRESS = "streetAddress";
|
||||
public static final String POSTOFFICEBOX = "postOfficeBox";
|
||||
public static final String POSTALCODE = "postalCode";
|
||||
|
||||
public static final String TITLE = "title";
|
||||
public static final String COMPANY = "company";
|
||||
public static final String DEPARTMENT = "department";
|
||||
public static final String EMPLOYEENUMBER = "employeeNumber";
|
||||
public static final String OU = "ou";
|
||||
public static final String DEPARTMENTNUMBER = "departmentNumber";
|
||||
|
||||
public static final String MANAGER = "manager";
|
||||
public static final String DIRECTREPORTS = "directReports";
|
||||
|
||||
public static final String MEMBER = "member";
|
||||
public static final String MEMBEROF = "memberOf";
|
||||
public static final String PRIMARYGROUPID = "primaryGroupID";
|
||||
|
||||
public static final String UNICODEPWD = "unicodePwd";
|
||||
public static final String DISTINGUISHEDNAME = "distinguishedname";
|
||||
|
||||
//MaxKey EXTEND
|
||||
/**
|
||||
* EXTEND managerName
|
||||
*/
|
||||
public static final String MANAGERNAME = "managerName";
|
||||
/**
|
||||
* EXTEND username
|
||||
*/
|
||||
public static final String USERNAME = "username";
|
||||
/**
|
||||
* EXTEND userType
|
||||
*/
|
||||
public static final String USERTYPE = "userType";
|
||||
/**
|
||||
* EXTEND gender
|
||||
*/
|
||||
public static final String GENDER = "gender";
|
||||
/**
|
||||
* EXTEND status
|
||||
*/
|
||||
public static final String USERSTATUS = "status";
|
||||
/**
|
||||
* EXTEND firstName
|
||||
*/
|
||||
public static final String FIRSTNAME = "firstName";
|
||||
/**
|
||||
* EXTEND lastName
|
||||
*/
|
||||
public static final String LASTNAME = "lastName";
|
||||
/**
|
||||
* EXTEND email
|
||||
*/
|
||||
public static final String EMAIL = "email";
|
||||
|
||||
/**
|
||||
* encodePassword for ActiveDirectory
|
||||
* @param password
|
||||
* @return
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
public static byte[] encodePassword(String password) throws UnsupportedEncodingException {
|
||||
return ("\"" + password + "\"").getBytes("UTF-16LE");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.dromara.maxkey.constants.ldap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* GroupOfNames objectclass attribute
|
||||
* top
|
||||
* @author shimingxy
|
||||
*
|
||||
*/
|
||||
public class GroupOfNames {
|
||||
public static ArrayList<String> OBJECTCLASS = new ArrayList<>(Arrays.asList("top", "groupOfNames"));
|
||||
|
||||
public static String objectClass = "groupOfNames";
|
||||
public static final String DISTINGUISHEDNAME = "distinguishedname";
|
||||
public static final String CN = "cn";
|
||||
public static final String MEMBER = "member";
|
||||
public static final String BUSINESSCATEGORY = "businessCategory";
|
||||
public static final String SEEALSO = "seeAlso";
|
||||
public static final String OWNER = "owner";
|
||||
public static final String OU = "ou";
|
||||
public static final String O = "o";
|
||||
public static final String DESCRIPTION = "description";
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.dromara.maxkey.constants.ldap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* GroupOfUniqueNames objectclass attribute
|
||||
* top
|
||||
* @author shimingxy
|
||||
*
|
||||
*/
|
||||
public class GroupOfUniqueNames {
|
||||
public static ArrayList<String> OBJECTCLASS = new ArrayList<>(Arrays.asList("top", "groupOfUniqueNames"));
|
||||
|
||||
public static String objectClass = "groupOfUniqueNames";
|
||||
public static final String DISTINGUISHEDNAME = "distinguishedname";
|
||||
public static final String CN = "cn";
|
||||
public static final String UNIQUEMEMBER = "uniqueMember";
|
||||
public static final String BUSINESSCATEGORY = "businessCategory";
|
||||
public static final String SEEALSO = "seeAlso";
|
||||
public static final String OWNER = "owner";
|
||||
public static final String OU = "ou";
|
||||
public static final String O = "o";
|
||||
public static final String DESCRIPTION = "description";
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
/*
|
||||
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.dromara.maxkey.constants.ldap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* InetOrgPerson objectclass attribute
|
||||
* top -> person -> organizationalPerson -> inetOrgPerson
|
||||
* @author shimingxy
|
||||
*
|
||||
*/
|
||||
public class InetOrgPerson {
|
||||
public static ArrayList<String> OBJECTCLASS = new ArrayList<>(Arrays.asList("top", "person","organizationalPerson","inetOrgPerson"));
|
||||
|
||||
public static String objectClass = "inetOrgPerson";
|
||||
public static final String DISTINGUISHEDNAME = "distinguishedname";
|
||||
//person sup top
|
||||
/**person sn MUST*/
|
||||
public static final String SN = "sn";
|
||||
/**person cn MUST*/
|
||||
public static final String CN = "cn";
|
||||
/**person userPassword*/
|
||||
public static final String USERPASSWORD = "userPassword";
|
||||
/**person userPassword*/
|
||||
public static final String TELEPHONENUMBER = "telephoneNumber";
|
||||
/**person seeAlso*/
|
||||
public static final String SEEALSO = "seeAlso";
|
||||
/**person description*/
|
||||
public static final String DESCRIPTION = "description";
|
||||
|
||||
//organizationalPerson sup person
|
||||
/**organizationalPerson title*/
|
||||
public static final String TITLE = "title";
|
||||
/**organizationalPerson x121Address*/
|
||||
public static final String X121ADDRESS = "x121Address";
|
||||
/**organizationalPerson registeredAddress*/
|
||||
public static final String REGISTEREDADDRESS = "registeredAddress";
|
||||
/**organizationalPerson destinationIndicator*/
|
||||
public static final String DESTINATIONINDICATOR = "destinationIndicator";
|
||||
/**organizationalPerson preferredDeliveryMethod*/
|
||||
public static final String PREFERREDDELIVERYMETHOD = "preferredDeliveryMethod";
|
||||
/**organizationalPerson telexNumber*/
|
||||
public static final String TELEXNUMBER = "telexNumber";
|
||||
/**organizationalPerson teletexTerminalIdentifier*/
|
||||
public static final String TELETEXTERMINALIDENTIFIER = "teletexTerminalIdentifier";
|
||||
/**organizationalPerson internationaliSDNNumber*/
|
||||
public static final String INTERNATIONALISDNNUMBER = "internationaliSDNNumber";
|
||||
/**organizationalPerson facsimileTelephoneNumber*/
|
||||
public static final String FACSIMILETELEPHONENUMBER = "facsimileTelephoneNumber";
|
||||
/**organizationalPerson street*/
|
||||
public static final String STREET = "street";
|
||||
/**organizationalPerson postOfficeBox*/
|
||||
public static final String POSTOFFICEBOX = "postOfficeBox";
|
||||
/**organizationalPerson postalCode*/
|
||||
public static final String POSTALCODE = "postalCode";
|
||||
/**organizationalPerson postalAddress*/
|
||||
public static final String POSTALADDRESS = "postalAddress";
|
||||
/**organizationalPerson physicalDeliveryOfficeName*/
|
||||
public static final String PHYSICALDELIVERYOFFICENAME = "physicalDeliveryOfficeName";
|
||||
/**organizationalPerson ou*/
|
||||
public static final String OU = "ou";
|
||||
/**organizationalPerson st*/
|
||||
public static final String ST = "st";
|
||||
/**organizationalPerson l*/
|
||||
public static final String L = "l";
|
||||
|
||||
//inetOrgPerson sup organizationalPerson
|
||||
/**inetOrgPerson carLicense*/
|
||||
public static final String CARLICENSE = "carLicense";
|
||||
/**inetOrgPerson departmentNumber*/
|
||||
public static final String DEPARTMENTNUMBER = "departmentNumber";
|
||||
/**inetOrgPerson displayName*/
|
||||
public static final String DISPLAYNAME = "displayName";
|
||||
/**inetOrgPerson employeeNumber*/
|
||||
public static final String EMPLOYEENUMBER = "employeeNumber";
|
||||
/**inetOrgPerson employeeType*/
|
||||
public static final String EMPLOYEETYPE = "employeeType";
|
||||
/**inetOrgPerson jpegPhoto*/
|
||||
public static final String JPEGPHOTO = "jpegPhoto";
|
||||
/**inetOrgPerson preferredLanguage*/
|
||||
public static final String PREFERREDLANGUAGE = "preferredLanguage";
|
||||
/**inetOrgPerson userSMIMECertificate*/
|
||||
public static final String USERSMIMECERTIFICATE = "userSMIMECertificate";
|
||||
/**inetOrgPerson userPKCS12*/
|
||||
public static final String USERPKCS12 = "userPKCS12";
|
||||
/**inetOrgPerson audio*/
|
||||
public static final String AUDIO = "audio";
|
||||
/**inetOrgPerson businessCategory*/
|
||||
public static final String BUSINESSCATEGORY = "businessCategory";
|
||||
/**inetOrgPerson givenName*/
|
||||
public static final String GIVENNAME = "givenName";
|
||||
/**inetOrgPerson homePhone*/
|
||||
public static final String HOMEPHONE = "homePhone";
|
||||
/**inetOrgPerson homePostalAddress*/
|
||||
public static final String HOMEPOSTALADDRESS = "homePostalAddress";
|
||||
/**inetOrgPerson initials*/
|
||||
public static final String INITIALS = "initials";
|
||||
/**inetOrgPerson photo*/
|
||||
public static final String PHOTO = "photo";
|
||||
/**inetOrgPerson roomNumber*/
|
||||
public static final String ROOMNUMBER = "roomNumber";
|
||||
/**inetOrgPerson secretary*/
|
||||
public static final String SECRETARY = "secretary";
|
||||
/**inetOrgPerson uid*/
|
||||
public static final String UID = "uid";
|
||||
/**inetOrgPerson userCertificate*/
|
||||
public static final String USERCERTIFICATE = "userCertificate";
|
||||
/**inetOrgPerson x500uniqueIdentifier*/
|
||||
public static final String X500UNIQUEIDENTIFIER = "x500uniqueIdentifier";
|
||||
|
||||
public static final String MAIL = "mail";
|
||||
|
||||
public static final String MOBILE = "mobile";
|
||||
|
||||
public static final String MANAGER = "manager";
|
||||
|
||||
//MaxKey EXTEND
|
||||
/**
|
||||
* EXTEND department
|
||||
*/
|
||||
public static final String DEPARTMENT = "department";
|
||||
/**
|
||||
* EXTEND firstName
|
||||
*/
|
||||
public static final String FIRSTNAME = "firstName";
|
||||
/**
|
||||
* EXTEND lastName
|
||||
*/
|
||||
public static final String LASTNAME = "lastName";
|
||||
/**
|
||||
* EXTEND email
|
||||
*/
|
||||
public static final String EMAIL = "email";
|
||||
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.dromara.maxkey.constants.ldap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Organization objectclass attribute
|
||||
* top
|
||||
* @author shimingxy
|
||||
*
|
||||
*/
|
||||
public class Organization {
|
||||
public static ArrayList<String> OBJECTCLASS = new ArrayList<>(Arrays.asList("top", "organization"));
|
||||
|
||||
public static String objectClass = "organization";
|
||||
public static final String DISTINGUISHEDNAME = "distinguishedname";
|
||||
|
||||
/**Organization o*/
|
||||
public static final String O = "o";
|
||||
/**Organization userPassword*/
|
||||
public static final String USERPASSWORD = "userPassword";
|
||||
/**Organization searchGuide*/
|
||||
public static final String SEARCHGUIDE = "searchGuide";
|
||||
/**Organization seeAlso*/
|
||||
public static final String SEEALSO = "seeAlso";
|
||||
/**Organization description*/
|
||||
public static final String DESCRIPTION = "description";
|
||||
/**Organization businessCategory*/
|
||||
public static final String BUSINESSCATEGORY = "businessCategory";
|
||||
/**Organization x121Address*/
|
||||
public static final String X121ADDRESS = "x121Address";
|
||||
/**Organization registeredAddress*/
|
||||
public static final String REGISTEREDADDRESS = "registeredAddress";
|
||||
/**Organization destinationIndicator*/
|
||||
public static final String DESTINATIONINDICATOR = "destinationIndicator";
|
||||
/**Organization preferredDeliveryMethod*/
|
||||
public static final String PREFERREDDELIVERYMETHOD = "preferredDeliveryMethod";
|
||||
/**Organization telexNumber*/
|
||||
public static final String TELEXNUMBER = "telexNumber";
|
||||
/**Organization teletexTerminalIdentifier*/
|
||||
public static final String TELETEXTERMINALIDENTIFIER = "teletexTerminalIdentifier";
|
||||
/**Organization telephoneNumber*/
|
||||
public static final String TELEPHONENUMBER = "telephoneNumber";
|
||||
/**Organization internationaliSDNNumber*/
|
||||
public static final String INTERNATIONALISDNNUMBER = "internationaliSDNNumber";
|
||||
/**Organization facsimileTelephoneNumber*/
|
||||
public static final String FACSIMILETELEPHONENUMBER = "facsimileTelephoneNumber";
|
||||
/**Organization street*/
|
||||
public static final String STREET = "street";
|
||||
/**Organization postOfficeBox*/
|
||||
public static final String POSTOFFICEBOX = "postOfficeBox";
|
||||
/**Organization postalCode*/
|
||||
public static final String POSTALCODE = "postalCode";
|
||||
/**Organization postalAddress*/
|
||||
public static final String POSTALADDRESS = "postalAddress";
|
||||
/**Organization physicalDeliveryOfficeName*/
|
||||
public static final String PHYSICALDELIVERYOFFICENAME = "physicalDeliveryOfficeName";
|
||||
/**Organization st*/
|
||||
public static final String ST = "st";
|
||||
/**Organization l*/
|
||||
public static final String L = "l";
|
||||
|
||||
//for id
|
||||
public static final String CN = "cn";
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.dromara.maxkey.constants.ldap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* OrganizationalUnit objectclass attribute
|
||||
* top
|
||||
* @author shimingxy
|
||||
*
|
||||
*/
|
||||
public class OrganizationalUnit {
|
||||
public static ArrayList<String> OBJECTCLASS = new ArrayList<>(Arrays.asList("top", "OrganizationalUnit"));
|
||||
public static String objectClass = "OrganizationalUnit";
|
||||
public static final String DISTINGUISHEDNAME = "distinguishedname";
|
||||
/**OrganizationalUnit ou*/
|
||||
public static final String OU = "ou";
|
||||
/**OrganizationalUnit userPassword*/
|
||||
public static final String USERPASSWORD = "userPassword";
|
||||
/**OrganizationalUnit searchGuide*/
|
||||
public static final String SEARCHGUIDE = "searchGuide";
|
||||
/**OrganizationalUnit seeAlso*/
|
||||
public static final String SEEALSO = "seeAlso";
|
||||
/**OrganizationalUnit description*/
|
||||
public static final String DESCRIPTION = "description";
|
||||
/**OrganizationalUnit businessCategory*/
|
||||
public static final String BUSINESSCATEGORY = "businessCategory";
|
||||
/**OrganizationalUnit x121Address*/
|
||||
public static final String X121ADDRESS = "x121Address";
|
||||
/**OrganizationalUnit registeredAddress*/
|
||||
public static final String REGISTEREDADDRESS = "registeredAddress";
|
||||
/**OrganizationalUnit destinationIndicator*/
|
||||
public static final String DESTINATIONINDICATOR = "destinationIndicator";
|
||||
/**OrganizationalUnit preferredDeliveryMethod*/
|
||||
public static final String PREFERREDDELIVERYMETHOD = "preferredDeliveryMethod";
|
||||
/**OrganizationalUnit telexNumber*/
|
||||
public static final String TELEXNUMBER = "telexNumber";
|
||||
/**OrganizationalUnit teletexTerminalIdentifier*/
|
||||
public static final String TELETEXTERMINALIDENTIFIER = "teletexTerminalIdentifier";
|
||||
/**OrganizationalUnit telephoneNumber*/
|
||||
public static final String TELEPHONENUMBER = "telephoneNumber";
|
||||
/**OrganizationalUnit internationaliSDNNumber*/
|
||||
public static final String INTERNATIONALISDNNUMBER = "internationaliSDNNumber";
|
||||
/**OrganizationalUnit facsimileTelephoneNumber*/
|
||||
public static final String FACSIMILETELEPHONENUMBER = "facsimileTelephoneNumber";
|
||||
/**OrganizationalUnit street*/
|
||||
public static final String STREET = "street";
|
||||
/**OrganizationalUnit postOfficeBox*/
|
||||
public static final String POSTOFFICEBOX = "postOfficeBox";
|
||||
/**OrganizationalUnit postalCode*/
|
||||
public static final String POSTALCODE = "postalCode";
|
||||
/**OrganizationalUnit postalAddress*/
|
||||
public static final String POSTALADDRESS = "postalAddress";
|
||||
/**OrganizationalUnit physicalDeliveryOfficeName*/
|
||||
public static final String PHYSICALDELIVERYOFFICENAME = "physicalDeliveryOfficeName";
|
||||
/**OrganizationalUnit st*/
|
||||
public static final String ST = "st";//省/州
|
||||
/**OrganizationalUnit l*/
|
||||
public static final String L = "l";//县市
|
||||
|
||||
public static final String CO = "co"; //中国
|
||||
public static final String C = "c"; //CN
|
||||
public static final String COUNTRYCODE = "countryCode";//156
|
||||
public static final String NAME = "name";
|
||||
|
||||
//for id
|
||||
public static final String CN = "cn";
|
||||
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.dromara.maxkey.persistence.ldap;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.directory.DirContext;
|
||||
import javax.naming.directory.SearchControls;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Crystal
|
||||
*
|
||||
*/
|
||||
public class ActiveDirectoryUtils extends LdapUtils {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(ActiveDirectoryUtils.class);
|
||||
|
||||
protected String domain;
|
||||
|
||||
String activeDirectoryDomain;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ActiveDirectoryUtils() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ActiveDirectoryUtils(String providerUrl, String principal, String credentials, String baseDN,
|
||||
String domain) {
|
||||
this.providerUrl = providerUrl;
|
||||
this.principal = principal;
|
||||
this.credentials = credentials;
|
||||
this.searchScope = SearchControls.SUBTREE_SCOPE;
|
||||
this.baseDN = baseDN;
|
||||
this.domain = domain.toUpperCase();
|
||||
}
|
||||
|
||||
public ActiveDirectoryUtils(String providerUrl, String principal, String credentials, String domain) {
|
||||
this.providerUrl = providerUrl;
|
||||
this.principal = principal;
|
||||
this.credentials = credentials;
|
||||
this.searchScope = SearchControls.SUBTREE_SCOPE;
|
||||
this.domain = domain.toUpperCase();
|
||||
}
|
||||
|
||||
public ActiveDirectoryUtils(DirContext dirContext) {
|
||||
this.ctx = dirContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initEnvironment() {
|
||||
if(props == null) {
|
||||
_logger.debug("PROVIDER_URL {}" , providerUrl);
|
||||
_logger.debug("SECURITY_PRINCIPAL {}" , principal);
|
||||
//no log credentials
|
||||
//_logger.trace("SECURITY_CREDENTIALS {}" , credentials);
|
||||
// LDAP
|
||||
props = new Properties();
|
||||
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
|
||||
props.setProperty(Context.URL_PKG_PREFIXES, "com.sun.jndi.url");
|
||||
props.setProperty(Context.REFERRAL, referral);
|
||||
props.setProperty(Context.SECURITY_AUTHENTICATION, "simple");
|
||||
|
||||
props.setProperty(Context.PROVIDER_URL, providerUrl);
|
||||
|
||||
if (domain.indexOf(".") > -1) {
|
||||
activeDirectoryDomain = domain.substring(0, domain.indexOf("."));
|
||||
}else {
|
||||
activeDirectoryDomain = domain;
|
||||
}
|
||||
|
||||
_logger.info("PROVIDER_DOMAIN : {} for {}" ,activeDirectoryDomain, domain);
|
||||
String activeDirectoryPrincipal = activeDirectoryDomain + "\\" + principal;
|
||||
_logger.debug("Active Directory SECURITY_PRINCIPAL : {}" , activeDirectoryPrincipal);
|
||||
props.setProperty(Context.SECURITY_PRINCIPAL, activeDirectoryPrincipal);
|
||||
props.setProperty(Context.SECURITY_CREDENTIALS, credentials);
|
||||
|
||||
if (ssl && providerUrl.toLowerCase().startsWith("ldaps")) {
|
||||
_logger.info("ldaps security protocol.");
|
||||
System.setProperty("javax.net.ssl.trustStore", trustStore);
|
||||
System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
|
||||
props.put(Context.SECURITY_PROTOCOL, "ssl");
|
||||
}
|
||||
props.put(Context.REFERRAL, "follow");
|
||||
}
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
public void setDomain(String domain) {
|
||||
this.domain = domain.toUpperCase();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,346 +0,0 @@
|
||||
/*
|
||||
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.dromara.maxkey.persistence.ldap;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.directory.Attribute;
|
||||
import javax.naming.directory.Attributes;
|
||||
import javax.naming.directory.DirContext;
|
||||
import javax.naming.directory.InitialDirContext;
|
||||
import javax.naming.directory.SearchControls;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Crystal
|
||||
*
|
||||
*/
|
||||
public class LdapUtils {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(LdapUtils.class);
|
||||
|
||||
public class Product{
|
||||
public static final String ActiveDirectory = "ActiveDirectory";
|
||||
public static final String OpenLDAP = "OpenLDAP";
|
||||
public static final String StandardLDAP = "StandardLDAP";
|
||||
}
|
||||
|
||||
|
||||
public static final String propertyBaseDN = "baseDN";
|
||||
public static final String propertyDomain = "domain";
|
||||
public static final String propertyTrustStore = "trustStore";
|
||||
public static final String propertyTrustStorePassword = "trustStorePassword";
|
||||
|
||||
protected DirContext ctx;
|
||||
protected String baseDN;
|
||||
protected String providerUrl;
|
||||
protected String principal;
|
||||
protected String credentials;
|
||||
protected String referral = "ignore";
|
||||
protected String trustStore;
|
||||
protected String trustStorePassword;
|
||||
protected boolean ssl;
|
||||
protected int searchScope;
|
||||
protected Properties props;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public LdapUtils() {
|
||||
super();
|
||||
this.searchScope = SearchControls.SUBTREE_SCOPE;
|
||||
}
|
||||
|
||||
public LdapUtils(String providerUrl, String principal, String credentials) {
|
||||
this.providerUrl = providerUrl;
|
||||
this.principal = principal;
|
||||
this.credentials = credentials;
|
||||
this.searchScope = SearchControls.SUBTREE_SCOPE;
|
||||
}
|
||||
|
||||
public LdapUtils(String providerUrl, String principal, String credentials, String baseDN) {
|
||||
this.providerUrl = providerUrl;
|
||||
this.principal = principal;
|
||||
this.credentials = credentials;
|
||||
this.searchScope = SearchControls.SUBTREE_SCOPE;
|
||||
this.baseDN = baseDN;
|
||||
}
|
||||
|
||||
public LdapUtils(DirContext dirContext) {
|
||||
this.ctx = dirContext;
|
||||
}
|
||||
|
||||
public void setSearchSubTreeScope() {
|
||||
this.searchScope = SearchControls.SUBTREE_SCOPE;
|
||||
}
|
||||
|
||||
public void setSearchOneLevelScope() {
|
||||
this.searchScope = SearchControls.ONELEVEL_SCOPE;
|
||||
}
|
||||
|
||||
protected DirContext InitialDirContext(Properties properties) {
|
||||
if(ctx == null) {
|
||||
ctx =createDirContext(properties);
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
protected DirContext createDirContext(Properties properties) {
|
||||
DirContext ctx = null;
|
||||
try {
|
||||
ctx = new InitialDirContext(properties);
|
||||
_logger.info("connect to ldap {} seccessful.",providerUrl);
|
||||
} catch (NamingException e) {
|
||||
_logger.error("connect to ldap {} fail.",providerUrl);
|
||||
_logger.error(e.getMessage());
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
protected void initEnvironment() {
|
||||
// LDAP
|
||||
if(props == null) {
|
||||
_logger.debug("PROVIDER_URL {}" , providerUrl);
|
||||
_logger.debug("SECURITY_PRINCIPAL {}" , principal);
|
||||
//no log credentials
|
||||
//_logger.trace("SECURITY_CREDENTIALS {}" , credentials);
|
||||
props = new Properties();
|
||||
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
|
||||
props.setProperty(Context.URL_PKG_PREFIXES, "com.sun.jndi.url");
|
||||
props.setProperty(Context.REFERRAL, referral);
|
||||
props.setProperty(Context.SECURITY_AUTHENTICATION, "simple");
|
||||
|
||||
props.setProperty(Context.PROVIDER_URL, providerUrl);
|
||||
props.setProperty(Context.SECURITY_PRINCIPAL, principal);
|
||||
props.setProperty(Context.SECURITY_CREDENTIALS, credentials);
|
||||
|
||||
if (ssl && providerUrl.toLowerCase().startsWith("ldaps")) {
|
||||
System.setProperty("javax.net.ssl.trustStore", trustStore);
|
||||
System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
|
||||
props.put(Context.SECURITY_PROTOCOL, "ssl");
|
||||
props.put(Context.REFERRAL, "follow");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// connect to ldap server
|
||||
public DirContext openConnection() {
|
||||
initEnvironment();
|
||||
return InitialDirContext(props);
|
||||
}
|
||||
|
||||
// connect to ldap server
|
||||
public DirContext createConnection() {
|
||||
initEnvironment();
|
||||
return createDirContext(props);
|
||||
}
|
||||
|
||||
public boolean authenticate() {
|
||||
openConnection();
|
||||
if (this.ctx != null) {
|
||||
close();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void close() {
|
||||
close(this.ctx);
|
||||
}
|
||||
|
||||
public void close(DirContext ctx) {
|
||||
if (null != ctx) {
|
||||
try {
|
||||
ctx.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
_logger.error(e.getMessage());
|
||||
} finally {
|
||||
ctx = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DirContext getCtx() {
|
||||
return ctx;
|
||||
}
|
||||
|
||||
public DirContext getConnection() {
|
||||
if (ctx == null) {
|
||||
openConnection();
|
||||
}
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the baseDN
|
||||
*/
|
||||
public String getBaseDN() {
|
||||
return baseDN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param baseDN the baseDN to set
|
||||
*/
|
||||
public void setBaseDN(String baseDN) {
|
||||
this.baseDN = baseDN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the searchScope
|
||||
*/
|
||||
public int getSearchScope() {
|
||||
return searchScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the providerUrl
|
||||
*/
|
||||
public String getProviderUrl() {
|
||||
return providerUrl;
|
||||
}
|
||||
|
||||
public String getPrincipal() {
|
||||
return principal;
|
||||
}
|
||||
|
||||
public void setPrincipal(String principal) {
|
||||
this.principal = principal;
|
||||
}
|
||||
|
||||
public String getCredentials() {
|
||||
return credentials;
|
||||
}
|
||||
|
||||
public void setCredentials(String credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
|
||||
public void setProviderUrl(String providerUrl) {
|
||||
this.providerUrl = providerUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the trustStore
|
||||
*/
|
||||
public String getTrustStore() {
|
||||
return trustStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param trustStore the trustStore to set
|
||||
*/
|
||||
public void setTrustStore(String trustStore) {
|
||||
this.trustStore = trustStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ssl
|
||||
*/
|
||||
public boolean isSsl() {
|
||||
return ssl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ssl the ssl to set
|
||||
*/
|
||||
public void setSsl(boolean ssl) {
|
||||
this.ssl = ssl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the referral
|
||||
*/
|
||||
public String getReferral() {
|
||||
return referral;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param referral the referral to set
|
||||
*/
|
||||
public void setReferral(String referral) {
|
||||
this.referral = referral;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the trustStorePassword
|
||||
*/
|
||||
public String getTrustStorePassword() {
|
||||
return trustStorePassword;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param trustStorePassword the trustStorePassword to set
|
||||
*/
|
||||
public void setTrustStorePassword(String trustStorePassword) {
|
||||
this.trustStorePassword = trustStorePassword;
|
||||
}
|
||||
|
||||
public static String getAttrStringValue(Attributes attrs, String elem) {
|
||||
StringBuffer values = new StringBuffer("");
|
||||
try {
|
||||
if (attrs.get(elem) != null) {
|
||||
for (int i = 0; i < attrs.get(elem).size(); i++) {
|
||||
if(i == 0) {
|
||||
values.append(attrs.get(elem).get(i).toString());
|
||||
}else {
|
||||
values.append(" , ").append(attrs.get(elem).get(i).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NamingException e) {
|
||||
e.printStackTrace();
|
||||
_logger.error(e.getMessage());
|
||||
}
|
||||
return values.toString();
|
||||
}
|
||||
|
||||
public static String getAttrStringValue(Attribute attr) {
|
||||
StringBuffer values = new StringBuffer("");
|
||||
try {
|
||||
if (attr != null) {
|
||||
for (int i = 0; i < attr.size(); i++) {
|
||||
if(i == 0) {
|
||||
values.append(attr.get(i).toString());
|
||||
}else {
|
||||
values.append(" , ").append(attr.get(i).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NamingException e) {
|
||||
e.printStackTrace();
|
||||
_logger.error(e.getMessage());
|
||||
}
|
||||
return values.toString();
|
||||
}
|
||||
|
||||
public static String getAttributeStringValue(String attribute ,HashMap<String,Attribute> attributeMap) throws NamingException {
|
||||
attribute= attribute.toLowerCase();
|
||||
if(null != attributeMap.get(attribute) && null != attributeMap.get(attribute).get()) {
|
||||
return attributeMap.get(attribute).get().toString();
|
||||
}else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ package org.dromara.maxkey.persistence.ldap;
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.directory.DirContext;
|
||||
|
||||
import org.dromara.maxkey.persistence.ldap.ActiveDirectoryUtils;
|
||||
import org.dromara.maxkey.ldap.ActiveDirectoryUtils;
|
||||
|
||||
public class ActiveDirectoryUtilsTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user