Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
c3d2a4b9
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,发现更多精彩内容 >>
提交
c3d2a4b9
编写于
1月 26, 2022
作者:
M
MaxKey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
no log ldap credentials
上级
c544b8b2
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
16 addition
and
14 deletion
+16
-14
maxkey-core/src/main/java/org/maxkey/persistence/ldap/ActiveDirectoryUtils.java
...ava/org/maxkey/persistence/ldap/ActiveDirectoryUtils.java
+4
-3
maxkey-core/src/main/java/org/maxkey/persistence/ldap/LdapUtils.java
.../src/main/java/org/maxkey/persistence/ldap/LdapUtils.java
+4
-3
maxkey-synchronizers/maxkey-synchronizer-activedirectory/src/main/java/org/maxkey/synchronizer/activedirectory/ActiveDirectoryOrganizationService.java
...r/activedirectory/ActiveDirectoryOrganizationService.java
+2
-2
maxkey-synchronizers/maxkey-synchronizer-activedirectory/src/main/java/org/maxkey/synchronizer/activedirectory/ActiveDirectoryUsersService.java
...hronizer/activedirectory/ActiveDirectoryUsersService.java
+6
-6
未找到文件。
maxkey-core/src/main/java/org/maxkey/persistence/ldap/ActiveDirectoryUtils.java
浏览文件 @
c3d2a4b9
...
@@ -68,9 +68,10 @@ public class ActiveDirectoryUtils extends LdapUtils {
...
@@ -68,9 +68,10 @@ public class ActiveDirectoryUtils extends LdapUtils {
@Override
@Override
protected
void
initEnvironment
()
{
protected
void
initEnvironment
()
{
if
(
props
==
null
)
{
if
(
props
==
null
)
{
_logger
.
info
(
"PROVIDER_URL:"
+
providerUrl
);
_logger
.
debug
(
"PROVIDER_URL {}"
,
providerUrl
);
_logger
.
info
(
"SECURITY_PRINCIPAL:"
+
principal
);
_logger
.
debug
(
"SECURITY_PRINCIPAL {}"
,
principal
);
_logger
.
info
(
"SECURITY_CREDENTIALS:"
+
credentials
);
//no log credentials
//_logger.trace("SECURITY_CREDENTIALS {}" , credentials);
// LDAP
// LDAP
props
=
new
Properties
();
props
=
new
Properties
();
props
.
setProperty
(
Context
.
INITIAL_CONTEXT_FACTORY
,
"com.sun.jndi.ldap.LdapCtxFactory"
);
props
.
setProperty
(
Context
.
INITIAL_CONTEXT_FACTORY
,
"com.sun.jndi.ldap.LdapCtxFactory"
);
...
...
maxkey-core/src/main/java/org/maxkey/persistence/ldap/LdapUtils.java
浏览文件 @
c3d2a4b9
...
@@ -112,9 +112,10 @@ public class LdapUtils {
...
@@ -112,9 +112,10 @@ public class LdapUtils {
protected
void
initEnvironment
()
{
protected
void
initEnvironment
()
{
// LDAP
// LDAP
if
(
props
==
null
)
{
if
(
props
==
null
)
{
_logger
.
debug
(
"PROVIDER_URL:"
+
providerUrl
);
_logger
.
debug
(
"PROVIDER_URL {}"
,
providerUrl
);
_logger
.
debug
(
"SECURITY_PRINCIPAL:"
+
principal
);
_logger
.
debug
(
"SECURITY_PRINCIPAL {}"
,
principal
);
_logger
.
trace
(
"SECURITY_CREDENTIALS:"
+
credentials
);
//no log credentials
//_logger.trace("SECURITY_CREDENTIALS {}" , credentials);
props
=
new
Properties
();
props
=
new
Properties
();
props
.
setProperty
(
Context
.
INITIAL_CONTEXT_FACTORY
,
"com.sun.jndi.ldap.LdapCtxFactory"
);
props
.
setProperty
(
Context
.
INITIAL_CONTEXT_FACTORY
,
"com.sun.jndi.ldap.LdapCtxFactory"
);
props
.
setProperty
(
Context
.
URL_PKG_PREFIXES
,
"com.sun.jndi.url"
);
props
.
setProperty
(
Context
.
URL_PKG_PREFIXES
,
"com.sun.jndi.url"
);
...
...
maxkey-synchronizers/maxkey-synchronizer-activedirectory/src/main/java/org/maxkey/synchronizer/activedirectory/ActiveDirectoryOrganizationService.java
浏览文件 @
c3d2a4b9
...
@@ -65,7 +65,7 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
...
@@ -65,7 +65,7 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
Object
obj
=
results
.
nextElement
();
Object
obj
=
results
.
nextElement
();
if
(
obj
instanceof
SearchResult
)
{
if
(
obj
instanceof
SearchResult
)
{
SearchResult
sr
=
(
SearchResult
)
obj
;
SearchResult
sr
=
(
SearchResult
)
obj
;
if
(
"OU=Domain Controllers,DC=maxkey,DC=top"
.
endsWith
(
sr
.
getNameInNamespace
()
))
{
if
(
sr
.
getNameInNamespace
().
contains
(
"OU=Domain Controllers"
))
{
_logger
.
info
(
"Skip 'OU=Domain Controllers' ."
);
_logger
.
info
(
"Skip 'OU=Domain Controllers' ."
);
continue
;
continue
;
}
}
...
@@ -76,7 +76,7 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
...
@@ -76,7 +76,7 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
NamingEnumeration
<?
extends
Attribute
>
attrs
=
sr
.
getAttributes
().
getAll
();
NamingEnumeration
<?
extends
Attribute
>
attrs
=
sr
.
getAttributes
().
getAll
();
while
(
null
!=
attrs
&&
attrs
.
hasMoreElements
())
{
while
(
null
!=
attrs
&&
attrs
.
hasMoreElements
())
{
Attribute
objAttrs
=
attrs
.
nextElement
();
Attribute
objAttrs
=
attrs
.
nextElement
();
_logger
.
trace
(
"attribute
"
+
objAttrs
.
getID
()
+
" : "
+
objAttrs
.
get
());
_logger
.
trace
(
"attribute
{} : {}"
,
objAttrs
.
getID
(),
objAttrs
.
get
());
attributeMap
.
put
(
objAttrs
.
getID
().
toLowerCase
(),
objAttrs
);
attributeMap
.
put
(
objAttrs
.
getID
().
toLowerCase
(),
objAttrs
);
}
}
...
...
maxkey-synchronizers/maxkey-synchronizer-activedirectory/src/main/java/org/maxkey/synchronizer/activedirectory/ActiveDirectoryUsersService.java
浏览文件 @
c3d2a4b9
...
@@ -25,6 +25,7 @@ import javax.naming.directory.SearchControls;
...
@@ -25,6 +25,7 @@ import javax.naming.directory.SearchControls;
import
javax.naming.directory.SearchResult
;
import
javax.naming.directory.SearchResult
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.maxkey.constants.ConstsStatus
;
import
org.maxkey.constants.ldap.ActiveDirectoryUser
;
import
org.maxkey.constants.ldap.ActiveDirectoryUser
;
import
org.maxkey.entity.HistorySynchronizer
;
import
org.maxkey.entity.HistorySynchronizer
;
import
org.maxkey.entity.Organizations
;
import
org.maxkey.entity.Organizations
;
...
@@ -59,9 +60,9 @@ public class ActiveDirectoryUsersService extends AbstractSynchronizerService
...
@@ -59,9 +60,9 @@ public class ActiveDirectoryUsersService extends AbstractSynchronizerService
Object
obj
=
results
.
nextElement
();
Object
obj
=
results
.
nextElement
();
if
(
obj
instanceof
SearchResult
)
{
if
(
obj
instanceof
SearchResult
)
{
SearchResult
sr
=
(
SearchResult
)
obj
;
SearchResult
sr
=
(
SearchResult
)
obj
;
if
(
sr
.
getNameInNamespace
().
indexOf
(
"CN=Users,DC=maxkey,DC=top"
)>-
1
if
(
sr
.
getNameInNamespace
().
contains
(
"CN=Users,"
)
||
sr
.
getNameInNamespace
().
indexOf
(
"OU=Domain Controllers,DC=maxkey,DC=top"
)>-
1
)
{
||
sr
.
getNameInNamespace
().
contains
(
"OU=Domain Controllers,"
)
)
{
_logger
.
info
(
"to skip.
"
);
_logger
.
trace
(
"Skip 'CN=Users' or 'OU=Domain Controllers' .
"
);
continue
;
continue
;
}
}
_logger
.
debug
(
"Sync User {} , name {} , NameInNamespace {}"
,
_logger
.
debug
(
"Sync User {} , name {} , NameInNamespace {}"
,
...
@@ -71,7 +72,7 @@ public class ActiveDirectoryUsersService extends AbstractSynchronizerService
...
@@ -71,7 +72,7 @@ public class ActiveDirectoryUsersService extends AbstractSynchronizerService
NamingEnumeration
<?
extends
Attribute
>
attrs
=
sr
.
getAttributes
().
getAll
();
NamingEnumeration
<?
extends
Attribute
>
attrs
=
sr
.
getAttributes
().
getAll
();
while
(
null
!=
attrs
&&
attrs
.
hasMoreElements
())
{
while
(
null
!=
attrs
&&
attrs
.
hasMoreElements
())
{
Attribute
objAttrs
=
attrs
.
nextElement
();
Attribute
objAttrs
=
attrs
.
nextElement
();
_logger
.
trace
(
"attribute
"
+
objAttrs
.
getID
()
+
" : "
+
objAttrs
.
get
());
_logger
.
trace
(
"attribute
{} : {}"
,
objAttrs
.
getID
(),
objAttrs
.
get
());
attributeMap
.
put
(
objAttrs
.
getID
().
toLowerCase
(),
objAttrs
);
attributeMap
.
put
(
objAttrs
.
getID
().
toLowerCase
(),
objAttrs
);
}
}
...
@@ -155,7 +156,7 @@ public class ActiveDirectoryUsersService extends AbstractSynchronizerService
...
@@ -155,7 +156,7 @@ public class ActiveDirectoryUsersService extends AbstractSynchronizerService
userInfo
.
setUserState
(
"RESIDENT"
);
userInfo
.
setUserState
(
"RESIDENT"
);
userInfo
.
setUserType
(
"EMPLOYEE"
);
userInfo
.
setUserType
(
"EMPLOYEE"
);
userInfo
.
setTimeZone
(
"Asia/Shanghai"
);
userInfo
.
setTimeZone
(
"Asia/Shanghai"
);
userInfo
.
setStatus
(
1
);
userInfo
.
setStatus
(
ConstsStatus
.
ACTIVE
);
userInfo
.
setInstId
(
this
.
synchronizer
.
getInstId
());
userInfo
.
setInstId
(
this
.
synchronizer
.
getInstId
());
HistorySynchronizer
historySynchronizer
=
new
HistorySynchronizer
();
HistorySynchronizer
historySynchronizer
=
new
HistorySynchronizer
();
...
@@ -169,7 +170,6 @@ public class ActiveDirectoryUsersService extends AbstractSynchronizerService
...
@@ -169,7 +170,6 @@ public class ActiveDirectoryUsersService extends AbstractSynchronizerService
historySynchronizer
.
setResult
(
"success"
);
historySynchronizer
.
setResult
(
"success"
);
this
.
historySynchronizerService
.
insert
(
historySynchronizer
);
this
.
historySynchronizerService
.
insert
(
historySynchronizer
);
}
catch
(
NamingException
e
)
{
}
catch
(
NamingException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录