Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
4b973880
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,发现更多精彩内容 >>
提交
4b973880
编写于
1月 27, 2022
作者:
M
MaxKey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
synchronizer-activedirectory
上级
506a2200
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
68 addition
and
43 deletion
+68
-43
maxkey-core/src/main/java/org/maxkey/entity/HistorySynchronizer.java
.../src/main/java/org/maxkey/entity/HistorySynchronizer.java
+32
-1
maxkey-synchronizers/maxkey-synchronizer-activedirectory/src/main/java/org/maxkey/synchronizer/activedirectory/ActiveDirectoryOrganizationService.java
...r/activedirectory/ActiveDirectoryOrganizationService.java
+14
-15
maxkey-synchronizers/maxkey-synchronizer-activedirectory/src/main/java/org/maxkey/synchronizer/activedirectory/ActiveDirectoryUsersService.java
...hronizer/activedirectory/ActiveDirectoryUsersService.java
+7
-9
maxkey-synchronizers/maxkey-synchronizer-ldap/src/main/java/org/maxkey/synchronizer/ldap/LdapOrganizationService.java
...org/maxkey/synchronizer/ldap/LdapOrganizationService.java
+8
-9
maxkey-synchronizers/maxkey-synchronizer-ldap/src/main/java/org/maxkey/synchronizer/ldap/LdapUsersService.java
...n/java/org/maxkey/synchronizer/ldap/LdapUsersService.java
+7
-9
未找到文件。
maxkey-core/src/main/java/org/maxkey/entity/HistorySynchronizer.java
浏览文件 @
4b973880
...
...
@@ -64,7 +64,38 @@ public class HistorySynchronizer extends JpaBaseEntity implements Serializable
String
startDate
;
String
endDate
;
public
String
getId
()
{
public
HistorySynchronizer
(
String
id
,
String
syncId
,
String
syncName
,
String
objectId
,
String
objectType
,
String
objectName
,
String
syncTime
,
String
result
,
String
instId
)
{
super
();
this
.
id
=
id
;
this
.
syncId
=
syncId
;
this
.
syncName
=
syncName
;
this
.
objectId
=
objectId
;
this
.
objectType
=
objectType
;
this
.
objectName
=
objectName
;
this
.
syncTime
=
syncTime
;
this
.
result
=
result
;
this
.
instId
=
instId
;
}
public
HistorySynchronizer
(
String
id
,
String
syncId
,
String
sessionId
,
String
syncName
,
String
objectId
,
String
objectType
,
String
objectName
,
String
syncTime
,
String
result
,
String
instId
)
{
super
();
this
.
id
=
id
;
this
.
syncId
=
syncId
;
this
.
sessionId
=
sessionId
;
this
.
syncName
=
syncName
;
this
.
objectId
=
objectId
;
this
.
objectType
=
objectType
;
this
.
objectName
=
objectName
;
this
.
syncTime
=
syncTime
;
this
.
result
=
result
;
this
.
instId
=
instId
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
...
...
maxkey-synchronizers/maxkey-synchronizer-activedirectory/src/main/java/org/maxkey/synchronizer/activedirectory/ActiveDirectoryOrganizationService.java
浏览文件 @
4b973880
...
...
@@ -65,11 +65,11 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
Object
obj
=
results
.
nextElement
();
if
(
obj
instanceof
SearchResult
)
{
SearchResult
sr
=
(
SearchResult
)
obj
;
if
(
sr
.
getNameInNamespace
().
contains
(
"OU=Domain Controllers"
))
{
_logger
.
info
(
"Skip 'OU=Domain Controllers' ."
);
if
(
sr
.
getNameInNamespace
().
contains
(
"OU=Domain Controllers"
)
||
StringUtils
.
isEmpty
(
sr
.
getName
())
)
{
_logger
.
info
(
"Skip
'' or
'OU=Domain Controllers' ."
);
continue
;
}
_logger
.
debug
(
"Sync OrganizationalUnit {} , name
{} , NameInNamespace {}
"
,
_logger
.
debug
(
"Sync OrganizationalUnit {} , name
[{}] , NameInNamespace [{}]
"
,
(++
recordCount
),
sr
.
getName
(),
sr
.
getNameInNamespace
());
HashMap
<
String
,
Attribute
>
attributeMap
=
new
HashMap
<
String
,
Attribute
>();
...
...
@@ -114,15 +114,16 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
organizationsService
.
saveOrUpdate
(
organization
);
orgsNamePathMap
.
put
(
organization
.
getNamePath
(),
organization
);
HistorySynchronizer
historySynchronizer
=
new
HistorySynchronizer
();
historySynchronizer
.
setId
(
historySynchronizer
.
generateId
());
historySynchronizer
.
setSyncId
(
this
.
synchronizer
.
getId
());
historySynchronizer
.
setSyncName
(
this
.
synchronizer
.
getName
());
historySynchronizer
.
setObjectId
(
organization
.
getId
());
historySynchronizer
.
setObjectName
(
organization
.
getName
());
historySynchronizer
.
setObjectType
(
Organizations
.
class
.
getSimpleName
());
historySynchronizer
.
setInstId
(
synchronizer
.
getInstId
());
historySynchronizer
.
setResult
(
"success"
);
HistorySynchronizer
historySynchronizer
=
new
HistorySynchronizer
(
synchronizer
.
generateId
(),
this
.
synchronizer
.
getId
(),
this
.
synchronizer
.
getName
(),
organization
.
getId
(),
organization
.
getName
(),
Organizations
.
class
.
getSimpleName
(),
org
.
maxkey
.
util
.
DateUtils
.
getCurrentDateAsString
(),
"success"
,
synchronizer
.
getInstId
());
this
.
historySynchronizerService
.
insert
(
historySynchronizer
);
}
}
...
...
@@ -140,9 +141,7 @@ public class ActiveDirectoryOrganizationService extends AbstractSynchronizerSer
try
{
Organizations
org
=
new
Organizations
();
org
.
setLdapDn
(
nameInNamespace
);
nameInNamespace
=
nameInNamespace
.
replaceAll
(
",OU="
,
"/"
).
replaceAll
(
"OU="
,
"/"
);
nameInNamespace
=
nameInNamespace
.
substring
(
0
,
nameInNamespace
.
length
()
-
ldapUtils
.
getBaseDN
().
length
()
-
1
);
String
[]
namePaths
=
nameInNamespace
.
split
(
"/"
);
String
[]
namePaths
=
name
.
replaceAll
(
",OU="
,
"/"
).
replaceAll
(
"OU="
,
"/"
).
split
(
"/"
);
String
namePah
=
"/"
+
rootOrganization
.
getName
();
for
(
int
i
=
namePaths
.
length
-
1
;
i
>=
0
;
i
--)
{
namePah
=
namePah
+
"/"
+
namePaths
[
i
];
...
...
maxkey-synchronizers/maxkey-synchronizer-activedirectory/src/main/java/org/maxkey/synchronizer/activedirectory/ActiveDirectoryUsersService.java
浏览文件 @
4b973880
...
...
@@ -65,7 +65,7 @@ public class ActiveDirectoryUsersService extends AbstractSynchronizerService
_logger
.
trace
(
"Skip 'CN=Users' or 'OU=Domain Controllers' . "
);
continue
;
}
_logger
.
debug
(
"Sync User {} , name
{} , NameInNamespace {}
"
,
_logger
.
debug
(
"Sync User {} , name
[{}] , NameInNamespace [{}]
"
,
(++
recordCount
),
sr
.
getName
(),
sr
.
getNameInNamespace
());
HashMap
<
String
,
Attribute
>
attributeMap
=
new
HashMap
<
String
,
Attribute
>();
...
...
@@ -99,14 +99,12 @@ public class ActiveDirectoryUsersService extends AbstractSynchronizerService
UserInfo
userInfo
=
new
UserInfo
();
userInfo
.
setLdapDn
(
nameInNamespace
);
nameInNamespace
=
nameInNamespace
.
replaceAll
(
",OU="
,
"/"
).
replaceAll
(
"OU="
,
"/"
).
replaceAll
(
"CN="
,
"/"
);
nameInNamespace
=
nameInNamespace
.
substring
(
0
,
nameInNamespace
.
length
()
-
ldapUtils
.
getBaseDN
().
length
()
-
1
);
_logger
.
info
(
"nameInNamespace "
+
nameInNamespace
);
String
[]
namePaths
=
nameInNamespace
.
split
(
"/"
);
String
namePah
=
"/"
+
rootOrganization
.
getName
();
for
(
int
i
=
namePaths
.
length
-
1
;
i
>=
1
;
i
--)
{
namePah
=
namePah
+
"/"
+
namePaths
[
i
];
}
String
[]
namePaths
=
name
.
replaceAll
(
",OU="
,
"/"
).
replaceAll
(
"OU="
,
"/"
).
split
(
"/"
);
String
namePah
=
"/"
+
rootOrganization
.
getName
();
for
(
int
i
=
namePaths
.
length
-
1
;
i
>=
0
;
i
--)
{
namePah
=
namePah
+
"/"
+
namePaths
[
i
];
}
//namePah = namePah.substring(0, namePah.length());
String
deptNamePath
=
namePah
.
substring
(
0
,
namePah
.
lastIndexOf
(
"/"
));
_logger
.
info
(
"deptNamePath "
+
deptNamePath
);
...
...
maxkey-synchronizers/maxkey-synchronizer-ldap/src/main/java/org/maxkey/synchronizer/ldap/LdapOrganizationService.java
浏览文件 @
4b973880
...
...
@@ -64,7 +64,7 @@ public class LdapOrganizationService extends AbstractSynchronizerService implem
Object
obj
=
results
.
nextElement
();
if
(
obj
instanceof
SearchResult
)
{
SearchResult
sr
=
(
SearchResult
)
obj
;
_logger
.
debug
(
"Sync OrganizationalUnit {} , name
{} , NameInNamespace {}
"
,
_logger
.
debug
(
"Sync OrganizationalUnit {} , name
[{}] , NameInNamespace [{}]
"
,
(++
recordCount
),
sr
.
getName
(),
sr
.
getNameInNamespace
());
HashMap
<
String
,
Attribute
>
attributeMap
=
new
HashMap
<
String
,
Attribute
>();
...
...
@@ -133,14 +133,13 @@ public class LdapOrganizationService extends AbstractSynchronizerService implem
try
{
Organizations
org
=
new
Organizations
();
org
.
setLdapDn
(
nameInNamespace
);
nameInNamespace
=
nameInNamespace
.
replaceAll
(
",ou="
,
"/"
).
replaceAll
(
"ou="
,
"/"
);
nameInNamespace
=
nameInNamespace
.
substring
(
0
,
nameInNamespace
.
length
()
-
ldapUtils
.
getBaseDN
().
length
()
-
1
);
String
[]
namePaths
=
nameInNamespace
.
split
(
"/"
);
String
namePah
=
"/"
+
rootOrganization
.
getName
();
for
(
int
i
=
namePaths
.
length
-
1
;
i
>=
0
;
i
--)
{
namePah
=
namePah
+
"/"
+
namePaths
[
i
];
}
namePah
=
namePah
.
substring
(
0
,
namePah
.
length
()
-
1
);
String
[]
namePaths
=
name
.
replaceAll
(
",OU="
,
"/"
).
replaceAll
(
"OU="
,
"/"
).
split
(
"/"
);
String
namePah
=
"/"
+
rootOrganization
.
getName
();
for
(
int
i
=
namePaths
.
length
-
1
;
i
>=
0
;
i
--)
{
namePah
=
namePah
+
"/"
+
namePaths
[
i
];
}
namePah
=
namePah
.
substring
(
0
,
namePah
.
length
()
-
1
);
org
.
setId
(
org
.
generateId
());
org
.
setCode
(
org
.
getId
());
...
...
maxkey-synchronizers/maxkey-synchronizer-ldap/src/main/java/org/maxkey/synchronizer/ldap/LdapUsersService.java
浏览文件 @
4b973880
...
...
@@ -58,7 +58,7 @@ public class LdapUsersService extends AbstractSynchronizerService implements IS
Object
obj
=
results
.
nextElement
();
if
(
obj
instanceof
SearchResult
)
{
SearchResult
sr
=
(
SearchResult
)
obj
;
_logger
.
debug
(
"Sync User {} , name
{} , NameInNamespace {}
"
,
_logger
.
debug
(
"Sync User {} , name
[{}] , NameInNamespace [{}]
"
,
(++
recordCount
),
sr
.
getName
(),
sr
.
getNameInNamespace
());
HashMap
<
String
,
Attribute
>
attributeMap
=
new
HashMap
<
String
,
Attribute
>();
...
...
@@ -93,14 +93,12 @@ public class LdapUsersService extends AbstractSynchronizerService implements IS
public
UserInfo
buildUserInfo
(
HashMap
<
String
,
Attribute
>
attributeMap
,
String
name
,
String
nameInNamespace
)
{
UserInfo
userInfo
=
new
UserInfo
();
userInfo
.
setLdapDn
(
nameInNamespace
);
nameInNamespace
=
nameInNamespace
.
replaceAll
(
",ou="
,
"/"
).
replaceAll
(
"ou="
,
"/"
).
replaceAll
(
"uid="
,
"/"
).
replaceAll
(
"cn="
,
"/"
);
nameInNamespace
=
nameInNamespace
.
substring
(
0
,
nameInNamespace
.
length
()
-
ldapUtils
.
getBaseDN
().
length
()
-
1
);
_logger
.
info
(
"nameInNamespace "
+
nameInNamespace
);
String
[]
namePaths
=
nameInNamespace
.
split
(
"/"
);
String
namePah
=
"/"
+
rootOrganization
.
getName
();
for
(
int
i
=
namePaths
.
length
-
1
;
i
>=
1
;
i
--)
{
namePah
=
namePah
+
"/"
+
namePaths
[
i
];
}
String
[]
namePaths
=
name
.
replaceAll
(
",OU="
,
"/"
).
replaceAll
(
"OU="
,
"/"
).
split
(
"/"
);
String
namePah
=
"/"
+
rootOrganization
.
getName
();
for
(
int
i
=
namePaths
.
length
-
1
;
i
>=
0
;
i
--)
{
namePah
=
namePah
+
"/"
+
namePaths
[
i
];
}
//namePah = namePah.substring(0, namePah.length());
String
deptNamePath
=
namePah
.
substring
(
0
,
namePah
.
lastIndexOf
(
"/"
));
_logger
.
info
(
"deptNamePath "
+
deptNamePath
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录