Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
7944b16b
MaxKey
项目概览
yujianwangzivayy
/
MaxKey
与 Fork 源项目一致
Fork自
MaxKey单点登录官方(MaxKeyTop) / MaxKey
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7944b16b
编写于
3月 03, 2022
作者:
M
MaxKey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
LDAP同步和登录问题
decoder credentials
上级
8f9c5dad
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
56 addition
and
32 deletion
+56
-32
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java
...a/org/maxkey/authn/realm/AbstractAuthenticationRealm.java
+3
-2
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/ldap/LdapAuthenticationRealmService.java
...xkey/authn/realm/ldap/LdapAuthenticationRealmService.java
+5
-2
maxkey-common/src/test/java/org/maxkey/crypto/ReciprocalUtilsTest.java
.../src/test/java/org/maxkey/crypto/ReciprocalUtilsTest.java
+3
-6
maxkey-synchronizers/maxkey-synchronizer-ldap/src/main/java/org/maxkey/synchronizer/ldap/LdapUsersService.java
...n/java/org/maxkey/synchronizer/ldap/LdapUsersService.java
+41
-21
maxkey-synchronizers/maxkey-synchronizer/src/main/java/org/maxkey/synchronizer/autoconfigure/SynchronizerAutoConfiguration.java
...hronizer/autoconfigure/SynchronizerAutoConfiguration.java
+4
-1
未找到文件。
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java
浏览文件 @
7944b16b
...
...
@@ -149,8 +149,9 @@ public abstract class AbstractAuthenticationRealm {
historyLogin
.
setBrowser
(
browser
.
getName
());
historyLogin
.
setPlatform
(
browser
.
getPlatform
());
historyLogin
.
setSourceIp
(
userInfo
.
getLastLoginIp
());
historyLogin
.
setIpRegion
(
IpRegionFactory
.
getFactory
().
region
(
userInfo
.
getLastLoginIp
()));
historyLogin
.
setIpLocation
(
IpRegionFactory
.
getFactory
().
getLocation
(
historyLogin
.
getIpRegion
()));
//TODO:
//historyLogin.setIpRegion(IpRegionFactory.getFactory().region(userInfo.getLastLoginIp()));
//historyLogin.setIpLocation(IpRegionFactory.getFactory().getLocation(historyLogin.getIpRegion()));
historyLogin
.
setProvider
(
provider
);
historyLogin
.
setCode
(
code
);
historyLogin
.
setLoginType
(
type
);
...
...
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/ldap/LdapAuthenticationRealmService.java
浏览文件 @
7944b16b
...
...
@@ -21,6 +21,7 @@ import java.util.List;
import
java.util.concurrent.TimeUnit
;
import
org.maxkey.authn.realm.IAuthenticationServer
;
import
org.maxkey.crypto.password.PasswordReciprocal
;
import
org.maxkey.entity.LdapContext
;
import
org.maxkey.persistence.ldap.ActiveDirectoryUtils
;
import
org.maxkey.persistence.ldap.LdapUtils
;
...
...
@@ -57,7 +58,8 @@ public class LdapAuthenticationRealmService {
ActiveDirectoryUtils
ldapUtils
=
new
ActiveDirectoryUtils
(
ldapContext
.
getProviderUrl
(),
ldapContext
.
getPrincipal
(),
ldapContext
.
getCredentials
(),
PasswordReciprocal
.
getInstance
().
decoder
(
ldapContext
.
getCredentials
()),
ldapContext
.
getMsadDomain
());
ldapServer
.
setActiveDirectoryUtils
(
ldapUtils
);
if
(
ldapContext
.
getAccountMapping
().
equalsIgnoreCase
(
"YES"
))
{
...
...
@@ -70,7 +72,8 @@ public class LdapAuthenticationRealmService {
LdapUtils
ldapUtils
=
new
LdapUtils
(
ldapContext
.
getProviderUrl
(),
ldapContext
.
getPrincipal
(),
ldapContext
.
getCredentials
(),
PasswordReciprocal
.
getInstance
().
decoder
(
ldapContext
.
getCredentials
()),
ldapContext
.
getBasedn
());
standardLdapServer
.
setLdapUtils
(
ldapUtils
);
standardLdapServer
.
setFilterAttribute
(
ldapContext
.
getFilters
());
...
...
maxkey-common/src/test/java/org/maxkey/crypto/ReciprocalUtilsTest.java
浏览文件 @
7944b16b
...
...
@@ -45,20 +45,17 @@ public class ReciprocalUtilsTest {
String urlencodeString="中国";
String urlencode = java.net.URLEncoder.encode(urlencodeString, "utf-8");
System.out.println(urlencode);
String urldecodeString="http://exchange.
connsec.com
/owa/?ae=Item&a=Open&t=IPM.Note&id=RgAAAABPKgpqnlfYQ7BVC%2fBfH2XIBwCS0xhUjzMYSLVky9bw7LddAAAAjov5AACS0xhUjzMYSLVky9bw7LddAAADzoy%2fAAAA&pspid=_1428036768398_867461813";
String urldecodeString="http://exchange.
maxkey.top
/owa/?ae=Item&a=Open&t=IPM.Note&id=RgAAAABPKgpqnlfYQ7BVC%2fBfH2XIBwCS0xhUjzMYSLVky9bw7LddAAAAjov5AACS0xhUjzMYSLVky9bw7LddAAADzoy%2fAAAA&pspid=_1428036768398_867461813";
String urldcode = java.net.URLDecoder.decode(urldecodeString, "utf-8");
System.out.println(urldcode);*/
String
encoderString
=
"
root
"
;
String
encoderString
=
"
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
"
;
encoderString
=
PasswordReciprocal
.
getInstance
().
encode
(
encoderString
);
System
.
out
.
println
(
encoderString
);
System
.
out
.
println
(
"length "
+
encoderString
.
length
());
encoderString
=
PasswordReciprocal
.
getInstance
().
decoder
(
encoderString
);
System
.
out
.
println
(
encoderString
);
...
...
maxkey-synchronizers/maxkey-synchronizer-ldap/src/main/java/org/maxkey/synchronizer/ldap/LdapUsersService.java
浏览文件 @
7944b16b
...
...
@@ -108,40 +108,60 @@ public class LdapUsersService extends AbstractSynchronizerService implements IS
try
{
userInfo
.
setId
(
userInfo
.
generateId
());
userInfo
.
setFormattedName
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
CN
,
attributeMap
));
//閸忋劌鎮�
//鐠愶附鍩�
userInfo
.
setUsername
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
UID
,
attributeMap
));
//鐠愶箑褰�
userInfo
.
setFamilyName
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
SN
,
attributeMap
));
//婵拷
userInfo
.
setGivenName
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
GIVENNAME
,
attributeMap
));
//閸氾拷
userInfo
.
setNickName
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
INITIALS
,
attributeMap
));
//閺勭數袨
userInfo
.
setNameZhShortSpell
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
INITIALS
,
attributeMap
));
//閼昏鲸鏋冪紓鈺佸晸
userInfo
.
setDisplayName
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
DISPLAYNAME
,
attributeMap
));
//閺勫墽銇氶崥宥囆�
String
cn
=
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
CN
,
attributeMap
);
String
uid
=
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
UID
,
attributeMap
);
String
sn
=
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
SN
,
attributeMap
);
String
givenName
=
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
GIVENNAME
,
attributeMap
);
String
initials
=
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
INITIALS
,
attributeMap
);
String
displayName
=
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
DISPLAYNAME
,
attributeMap
);
userInfo
.
setFormattedName
(
sn
+
givenName
);
if
(
StringUtils
.
isBlank
(
uid
))
{
userInfo
.
setUsername
(
cn
);
userInfo
.
setWindowsAccount
(
cn
);
}
else
{
userInfo
.
setUsername
(
uid
);
userInfo
.
setWindowsAccount
(
uid
);
}
userInfo
.
setFamilyName
(
sn
);
userInfo
.
setGivenName
(
givenName
);
if
(
StringUtils
.
isBlank
(
initials
))
{
userInfo
.
setNickName
(
sn
+
givenName
);
userInfo
.
setNameZhShortSpell
(
sn
+
givenName
);
}
else
{
userInfo
.
setNickName
(
initials
);
userInfo
.
setNameZhShortSpell
(
initials
);
}
if
(
StringUtils
.
isBlank
(
displayName
))
{
userInfo
.
setDisplayName
(
sn
+
givenName
);
}
else
{
userInfo
.
setDisplayName
(
displayName
);
}
userInfo
.
setEmployeeNumber
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
EMPLOYEENUMBER
,
attributeMap
));
//userInfo.setDepartment(LdapUtils.getAttributeStringValue(InetOrgPerson.OU,attributeMap));
//userInfo.setDepartmentId(LdapUtils.getAttributeStringValue(InetOrgPerson.DEPARTMENTNUMBER,attributeMap));
userInfo
.
setJobTitle
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
TITLE
,
attributeMap
));
//閼卞苯濮�
userInfo
.
setWorkOfficeName
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
PHYSICALDELIVERYOFFICENAME
,
attributeMap
));
//閸旂偛鍙曠�癸拷
userInfo
.
setWorkEmail
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
MAIL
,
attributeMap
));
//闁喕娆�
userInfo
.
setWorkRegion
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
ST
,
attributeMap
));
//閻拷
userInfo
.
setWorkLocality
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
L
,
attributeMap
));
//閸橈拷
userInfo
.
setWorkStreetAddress
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
STREET
,
attributeMap
));
//鐞涙浜�
userInfo
.
setWorkPostalCode
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
POSTALCODE
,
attributeMap
));
//闁喚绱�
userInfo
.
setWorkAddressFormatted
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
POSTOFFICEBOX
,
attributeMap
));
//闁喗鏂傞柇顔绢唸
userInfo
.
setJobTitle
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
TITLE
,
attributeMap
));
userInfo
.
setWorkOfficeName
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
PHYSICALDELIVERYOFFICENAME
,
attributeMap
));
userInfo
.
setWorkEmail
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
MAIL
,
attributeMap
));
userInfo
.
setWorkRegion
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
ST
,
attributeMap
));
userInfo
.
setWorkLocality
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
L
,
attributeMap
));
userInfo
.
setWorkStreetAddress
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
STREET
,
attributeMap
));
userInfo
.
setWorkPostalCode
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
POSTALCODE
,
attributeMap
));
userInfo
.
setWorkAddressFormatted
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
POSTOFFICEBOX
,
attributeMap
));
userInfo
.
setWorkFax
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
FACSIMILETELEPHONENUMBER
,
attributeMap
));
userInfo
.
setHomePhoneNumber
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
HOMEPHONE
,
attributeMap
));
//鐎硅泛娑甸悽浣冪樈
userInfo
.
setHomeAddressFormatted
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
HOMEPOSTALADDRESS
,
attributeMap
));
//閻絻鐦芥径鍥ㄦ暈
userInfo
.
setHomePhoneNumber
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
HOMEPHONE
,
attributeMap
));
userInfo
.
setHomeAddressFormatted
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
HOMEPOSTALADDRESS
,
attributeMap
));
if
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
MOBILE
,
attributeMap
).
equals
(
""
))
{
userInfo
.
setMobile
(
userInfo
.
getId
());
}
else
{
userInfo
.
setMobile
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
MOBILE
,
attributeMap
));
//閹靛婧�
userInfo
.
setMobile
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
MOBILE
,
attributeMap
));
}
userInfo
.
setPreferredLanguage
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
PREFERREDLANGUAGE
,
attributeMap
));
//鐠囶叀鈻�
userInfo
.
setPreferredLanguage
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
PREFERREDLANGUAGE
,
attributeMap
));
userInfo
.
setDescription
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
DESCRIPTION
,
attributeMap
));
//閹诲繗鍫�
userInfo
.
setDescription
(
LdapUtils
.
getAttributeStringValue
(
InetOrgPerson
.
DESCRIPTION
,
attributeMap
));
userInfo
.
setUserState
(
"RESIDENT"
);
userInfo
.
setUserType
(
"EMPLOYEE"
);
userInfo
.
setTimeZone
(
"Asia/Shanghai"
);
...
...
maxkey-synchronizers/maxkey-synchronizer/src/main/java/org/maxkey/synchronizer/autoconfigure/SynchronizerAutoConfiguration.java
浏览文件 @
7944b16b
...
...
@@ -21,6 +21,7 @@ import java.sql.ResultSet;
import
java.sql.SQLException
;
import
java.util.List
;
import
org.maxkey.crypto.password.PasswordReciprocal
;
import
org.maxkey.entity.Synchronizers
;
import
org.maxkey.synchronizer.SynchronizerJob
;
import
org.quartz.CronExpression
;
...
...
@@ -104,7 +105,9 @@ public class SynchronizerAutoConfiguration implements InitializingBean {
synchronizer
.
setProviderUrl
(
rs
.
getString
(
"providerurl"
));
synchronizer
.
setDriverClass
(
rs
.
getString
(
"driverclass"
));
synchronizer
.
setPrincipal
(
rs
.
getString
(
"principal"
));
synchronizer
.
setCredentials
(
rs
.
getString
(
"credentials"
));
synchronizer
.
setCredentials
(
PasswordReciprocal
.
getInstance
().
decoder
(
rs
.
getString
(
"credentials"
)));
synchronizer
.
setResumeTime
(
rs
.
getString
(
"resumetime"
));
synchronizer
.
setSuspendTime
(
rs
.
getString
(
"suspendtime"
));
synchronizer
.
setFilters
(
rs
.
getString
(
"filters"
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录