Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MaxKey单点登录官方(MaxKeyTop)
MaxKey
提交
41df3c5c
MaxKey
项目概览
MaxKey单点登录官方(MaxKeyTop)
/
MaxKey
8 个月 前同步成功
通知
75
Star
3
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
41df3c5c
编写于
9月 27, 2021
作者:
MaxKey单点登录官方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v3.0.0GA with SAML User Attributes
上级
2c5c2c07
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
4 deletion
+41
-4
maxkey-core/src/main/java/org/maxkey/constants/ldap/ActiveDirectoryUser.java
...n/java/org/maxkey/constants/ldap/ActiveDirectoryUser.java
+7
-0
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/endpoint/AssertionEndpoint.java
...key/authz/saml20/provider/endpoint/AssertionEndpoint.java
+4
-2
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/xml/AttributeStatementGenerator.java
...uthz/saml20/provider/xml/AttributeStatementGenerator.java
+29
-1
maxkey-webs/maxkey-web-resources/build.gradle
maxkey-webs/maxkey-web-resources/build.gradle
+1
-1
未找到文件。
maxkey-core/src/main/java/org/maxkey/constants/ldap/ActiveDirectoryUser.java
浏览文件 @
41df3c5c
...
...
@@ -178,6 +178,13 @@ public class ActiveDirectoryUser {
public
static
final
String
UNICODEPWD
=
"unicodePwd"
;
public
static
final
String
DISTINGUISHEDNAME
=
"distinguishedname"
;
//MaxKey EXTEND
public
static
final
String
MANAGERNAME
=
"managerName"
;
public
static
final
String
USERNAME
=
"username"
;
public
static
final
String
USERTYPE
=
"userType"
;
public
static
final
String
GENDER
=
"gender"
;
public
static
final
String
USERSTATUS
=
"status"
;
public
static
byte
[]
encodePassword
(
String
password
)
throws
UnsupportedEncodingException
{
return
(
"\""
+
password
+
"\""
).
getBytes
(
"UTF-16LE"
);
...
...
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/endpoint/AssertionEndpoint.java
浏览文件 @
41df3c5c
...
...
@@ -72,9 +72,9 @@ public class AssertionEndpoint {
}
logger
.
debug
(
"AuthnRequestInfo: {}"
,
authnRequestInfo
);
HashMap
<
String
,
String
>
attributeMap
=
new
HashMap
<
String
,
String
>();
attributeMap
.
put
(
WebConstants
.
ONLINE_TICKET_NAME
,
((
SigninPrincipal
)
WebContext
.
getAuthentication
().
getPrincipal
()).
getOnlineTicket
().
getTicketId
());
attributeMap
.
put
(
WebConstants
.
ONLINE_TICKET_NAME
,
((
SigninPrincipal
)
WebContext
.
getAuthentication
().
getPrincipal
()).
getOnlineTicket
().
getTicketId
());
//saml20Details
Response
authResponse
=
authnResponseGenerator
.
generateAuthnResponse
(
...
...
@@ -97,5 +97,7 @@ public class AssertionEndpoint {
}
return
null
;
}
}
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/xml/AttributeStatementGenerator.java
浏览文件 @
41df3c5c
...
...
@@ -25,9 +25,12 @@ import java.util.Map;
import
java.util.Map.Entry
;
import
org.maxkey.constants.Boolean
;
import
org.maxkey.constants.ldap.ActiveDirectoryUser
;
import
org.maxkey.entity.ExtraAttr
;
import
org.maxkey.entity.ExtraAttrs
;
import
org.maxkey.entity.UserInfo
;
import
org.maxkey.entity.apps.AppsSAML20Details
;
import
org.maxkey.web.WebContext
;
import
org.opensaml.Configuration
;
import
org.opensaml.saml2.core.Attribute
;
import
org.opensaml.saml2.core.AttributeStatement
;
...
...
@@ -62,6 +65,8 @@ public class AttributeStatementGenerator {
Attribute
attributeGrantedAuthority
=
builderGrantedAuthority
(
grantedAuthoritys
);
attributeStatement
.
getAttributes
().
add
(
attributeGrantedAuthority
);
putUserAttributes
(
attributeMap
);
if
(
null
!=
attributeMap
){
Iterator
<
Entry
<
String
,
String
>>
iterator
=
attributeMap
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
...
...
@@ -121,6 +126,29 @@ public class AttributeStatementGenerator {
return
xsStringValue
;
}
public
HashMap
<
String
,
String
>
putUserAttributes
(
HashMap
<
String
,
String
>
attributeMap
){
UserInfo
userInfo
=
WebContext
.
getUserInfo
();
attributeMap
.
put
(
ActiveDirectoryUser
.
USERNAME
,
userInfo
.
getUsername
());
attributeMap
.
put
(
ActiveDirectoryUser
.
UID
,
userInfo
.
getUsername
());
attributeMap
.
put
(
ActiveDirectoryUser
.
EMPLOYEENUMBER
,
userInfo
.
getEmployeeNumber
());
attributeMap
.
put
(
ActiveDirectoryUser
.
DEPARTMENTNUMBER
,
userInfo
.
getDepartmentId
());
attributeMap
.
put
(
ActiveDirectoryUser
.
DEPARTMENT
,
userInfo
.
getDepartment
());
attributeMap
.
put
(
ActiveDirectoryUser
.
COMPANY
,
userInfo
.
getDivision
());
attributeMap
.
put
(
ActiveDirectoryUser
.
TITLE
,
userInfo
.
getJobTitle
());
attributeMap
.
put
(
ActiveDirectoryUser
.
MANAGER
,
userInfo
.
getManagerId
());
attributeMap
.
put
(
ActiveDirectoryUser
.
MANAGERNAME
,
userInfo
.
getManager
());
attributeMap
.
put
(
ActiveDirectoryUser
.
DISPLAYNAME
,
userInfo
.
getDisplayName
());
attributeMap
.
put
(
ActiveDirectoryUser
.
GIVENNAME
,
userInfo
.
getGivenName
());
attributeMap
.
put
(
ActiveDirectoryUser
.
SN
,
userInfo
.
getFamilyName
());
attributeMap
.
put
(
ActiveDirectoryUser
.
GENDER
,
userInfo
.
getGender
()
+
""
);
attributeMap
.
put
(
ActiveDirectoryUser
.
MAIL
,
userInfo
.
getEmail
());
attributeMap
.
put
(
ActiveDirectoryUser
.
MOBILE
,
userInfo
.
getMobile
());
attributeMap
.
put
(
ActiveDirectoryUser
.
USERSTATUS
,
userInfo
.
getStatus
()
+
""
);
return
attributeMap
;
}
}
maxkey-webs/maxkey-web-resources/build.gradle
浏览文件 @
41df3c5c
description
=
"maxkey-web-
static
"
description
=
"maxkey-web-
resources
"
//add support for Java
apply
plugin:
'java'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录