Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
69159e46
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,发现更多精彩内容 >>
提交
69159e46
编写于
9月 23, 2020
作者:
MaxKey单点登录官方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SAML FIX
上级
119810b0
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
62 addition
and
4 deletion
+62
-4
ReleaseNotes.txt
ReleaseNotes.txt
+3
-2
maxkey-core/src/main/java/org/maxkey/domain/apps/AppsSAML20Details.java
...c/main/java/org/maxkey/domain/apps/AppsSAML20Details.java
+11
-0
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/xml/AssertionGenerator.java
.../maxkey/authz/saml20/provider/xml/AssertionGenerator.java
+1
-0
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/xml/SubjectGenerator.java
...rg/maxkey/authz/saml20/provider/xml/SubjectGenerator.java
+47
-2
未找到文件。
ReleaseNotes.txt
浏览文件 @
69159e46
...
...
@@ -32,8 +32,9 @@
*(MAXKEY-200831) MySQL时间问题,参见https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html
*(MAXKEY-200832) OAuth2 Password模式修复
*(MAXKEY-200833) MGT管理SAML上传问题、IDP元数据链接优化、主键生成修复、元数据参数配置调整
*(MAXKEY-200834) MGT管理TOKENBASED令牌主键生成修复
*(MAXKEY-200835) 依赖jar升级
*(MAXKEY-200834) SAML 2添加多种NameId的支持,支持后缀的配置,NameId支持大小写转换
*(MAXKEY-200835) MGT管理TOKENBASED令牌主键生成修复
*(MAXKEY-200836) 依赖jar升级
tomcat 9.0.38
passay 1.6.0
springBootVersion 2.3.4.RELEASE
...
...
maxkey-core/src/main/java/org/maxkey/domain/apps/AppsSAML20Details.java
浏览文件 @
69159e46
...
...
@@ -94,6 +94,9 @@ public class AppsSAML20Details extends Apps {
@Column
private
int
nameIdConvert
;
@Column
private
String
nameIdSuffix
;
public
static
final
class
BindingType
{
public
static
final
String
Redirect_Post
=
"Redirect-Post"
;
public
static
final
String
Post_Post
=
"Post-Post"
;
...
...
@@ -327,6 +330,14 @@ public class AppsSAML20Details extends Apps {
this
.
digestMethod
=
digestMethod
;
}
public
String
getNameIdSuffix
()
{
return
nameIdSuffix
;
}
public
void
setNameIdSuffix
(
String
nameIdSuffix
)
{
this
.
nameIdSuffix
=
nameIdSuffix
;
}
@Override
public
String
toString
()
{
final
int
maxLen
=
40
;
...
...
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/xml/AssertionGenerator.java
浏览文件 @
69159e46
...
...
@@ -85,6 +85,7 @@ public class AssertionGenerator {
Assertion
assertion
=
new
AssertionBuilder
().
buildObject
();;
//Subject
Subject
subject
=
subjectGenerator
.
generateSubject
(
saml20Details
,
assertionConsumerURL
,
inResponseTo
,
validInSeconds
);
...
...
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/xml/SubjectGenerator.java
浏览文件 @
69159e46
...
...
@@ -19,7 +19,10 @@
package
org.maxkey.authz.saml20.provider.xml
;
import
org.apache.commons.lang3.StringUtils
;
import
org.maxkey.authz.saml.service.TimeService
;
import
org.maxkey.domain.UserInfo
;
import
org.maxkey.domain.apps.AppsSAML20Details
;
import
org.maxkey.web.WebContext
;
import
org.opensaml.saml2.core.NameID
;
import
org.opensaml.saml2.core.NameIDType
;
...
...
@@ -41,12 +44,54 @@ public class SubjectGenerator {
this
.
timeService
=
timeService
;
}
public
Subject
generateSubject
(
public
Subject
generateSubject
(
AppsSAML20Details
saml20Details
,
String
assertionConsumerURL
,
String
inResponseTo
,
int
validInSeconds
)
{
UserInfo
userInfo
=
WebContext
.
getUserInfo
();
String
nameIdValue
=
userInfo
.
getUsername
();
if
(
saml20Details
.
getNameidFormat
().
equalsIgnoreCase
(
"persistent"
))
{
}
else
if
(
saml20Details
.
getNameidFormat
().
equalsIgnoreCase
(
"transient"
))
{
}
else
if
(
saml20Details
.
getNameidFormat
().
equalsIgnoreCase
(
"unspecified"
))
{
}
else
if
(
saml20Details
.
getNameidFormat
().
equalsIgnoreCase
(
"emailAddress"
))
{
if
(
userInfo
.
getEmail
()!=
null
&&
!
userInfo
.
getEmail
().
equals
(
""
))
{
nameIdValue
=
userInfo
.
getEmail
();
}
}
else
if
(
saml20Details
.
getNameidFormat
().
equalsIgnoreCase
(
"X509SubjectName"
))
{
}
else
if
(
saml20Details
.
getNameidFormat
().
equalsIgnoreCase
(
"WindowsDomainQualifiedName"
))
{
if
(
userInfo
.
getWindowsAccount
()!=
null
&&
!
userInfo
.
getWindowsAccount
().
equals
(
""
))
{
nameIdValue
=
userInfo
.
getWindowsAccount
();
}
}
else
if
(
saml20Details
.
getNameidFormat
().
equalsIgnoreCase
(
"entity"
))
{
}
else
if
(
saml20Details
.
getNameidFormat
().
equalsIgnoreCase
(
"custom"
))
{
}
else
if
(
saml20Details
.
getNameidFormat
().
equalsIgnoreCase
(
"Mobile"
))
{
if
(
userInfo
.
getMobile
()!=
null
&&
!
userInfo
.
getMobile
().
equals
(
""
))
{
nameIdValue
=
userInfo
.
getMobile
();
}
}
else
if
(
saml20Details
.
getNameidFormat
().
equalsIgnoreCase
(
"EmployeeNumber"
))
{
if
(
userInfo
.
getEmployeeNumber
()!=
null
&&
!
userInfo
.
getEmployeeNumber
().
equals
(
""
))
{
nameIdValue
=
userInfo
.
getEmployeeNumber
();
}
}
if
(!
StringUtils
.
isEmpty
(
saml20Details
.
getNameIdSuffix
()))
{
nameIdValue
=
nameIdValue
+
saml20Details
.
getNameIdSuffix
();
}
if
(
saml20Details
.
getNameIdConvert
()==
0
)
{
}
else
if
(
saml20Details
.
getNameIdConvert
()==
1
)
{
nameIdValue
=
nameIdValue
.
toUpperCase
();
}
else
if
(
saml20Details
.
getNameIdConvert
()==
1
)
{
nameIdValue
=
nameIdValue
.
toLowerCase
();
}
String
nameIdValue
=
WebContext
.
getUserInfo
().
getUsername
();
NameID
nameID
=
builderNameID
(
nameIdValue
,
assertionConsumerURL
);
Subject
subject
=
builderSubject
(
nameID
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录