Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
f69e192a
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,发现更多精彩内容 >>
提交
f69e192a
编写于
11月 21, 2020
作者:
MaxKey单点登录官方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Saml 20 Logout
上级
a99ecf16
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
118 addition
and
42 deletion
+118
-42
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml/common/SignatureSecurityPolicyRule.java
...maxkey/authz/saml/common/SignatureSecurityPolicyRule.java
+0
-1
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/endpoint/LogoutSamlEndpoint.java
...ey/authz/saml20/provider/endpoint/LogoutSamlEndpoint.java
+67
-0
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/endpoint/SingleSignOnEndpoint.java
.../authz/saml20/provider/endpoint/SingleSignOnEndpoint.java
+51
-41
未找到文件。
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml/common/SignatureSecurityPolicyRule.java
浏览文件 @
f69e192a
...
...
@@ -101,7 +101,6 @@ public class SignatureSecurityPolicyRule implements InitializingBean, SecurityP
private
void
checkMessageSignature
(
MessageContext
messageContext
,
SignableSAMLObject
samlMessage
)
throws
SecurityPolicyException
{
CriteriaSet
criteriaSet
=
new
CriteriaSet
();
logger
.
debug
(
"Inbound issuer is {}"
,
messageContext
.
getInboundMessageIssuer
());
// System.out.println("Inbound issuer is {} "+ messageContext.getInboundMessageIssuer());
//https://localhost-dev-ed.my.salesforce.com
criteriaSet
.
add
(
new
EntityIDCriteria
(
messageContext
.
getInboundMessageIssuer
()));
//criteriaSet.add( new EntityIDCriteria("https://localhost-dev-ed.my.salesforce.com"));
...
...
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/endpoint/LogoutSamlEndpoint.java
0 → 100644
浏览文件 @
f69e192a
package
org.maxkey.authz.saml20.provider.endpoint
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.maxkey.authz.saml20.binding.ExtractBindingAdapter
;
import
org.maxkey.authz.saml20.xml.SAML2ValidatorSuite
;
import
org.maxkey.web.WebContext
;
import
org.opensaml.common.binding.SAMLMessageContext
;
import
org.opensaml.saml2.core.LogoutRequest
;
import
org.opensaml.ws.message.decoder.MessageDecodingException
;
import
org.opensaml.xml.security.SecurityException
;
import
org.opensaml.xml.validation.ValidationException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.servlet.ModelAndView
;
@Controller
public
class
LogoutSamlEndpoint
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
LogoutSamlEndpoint
.
class
);
@Autowired
@Qualifier
(
"extractRedirectBindingAdapter"
)
private
ExtractBindingAdapter
extractRedirectBindingAdapter
;
@Autowired
@Qualifier
(
"samlValidaotrSuite"
)
private
SAML2ValidatorSuite
validatorSuite
;
@SuppressWarnings
(
"rawtypes"
)
@RequestMapping
(
value
=
"/logout/saml"
,
method
=
RequestMethod
.
GET
)
public
ModelAndView
samlRedirectLogout
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
SAMLMessageContext
messageContext
;
logger
.
debug
(
"extract SAML Message ."
);
try
{
messageContext
=
extractRedirectBindingAdapter
.
extractSAMLMessageContext
(
request
);
logger
.
debug
(
"validate SAML LogoutRequest ."
);
LogoutRequest
logoutRequest
=
(
LogoutRequest
)
messageContext
.
getInboundSAMLMessage
();
validatorSuite
.
validate
(
logoutRequest
);
logger
.
debug
(
"LogoutRequest ID "
+
logoutRequest
.
getID
());
logger
.
debug
(
"LogoutRequest Issuer "
+
logoutRequest
.
getIssuer
());
logger
.
debug
(
"LogoutRequest IssueInstant "
+
logoutRequest
.
getIssueInstant
());
logger
.
debug
(
"LogoutRequest Destination "
+
logoutRequest
.
getDestination
());
logger
.
debug
(
"LogoutRequest NameID "
+
logoutRequest
.
getNameID
().
getValue
());
return
WebContext
.
redirect
(
"/logout"
);
}
catch
(
MessageDecodingException
e1
)
{
logger
.
error
(
"Exception decoding SAML MessageDecodingException"
,
e1
);
}
catch
(
SecurityException
e1
)
{
logger
.
error
(
"Exception decoding SAML SecurityException"
,
e1
);
}
catch
(
ValidationException
ve
)
{
logger
.
warn
(
"logoutRequest Message failed Validation"
,
ve
);
}
return
WebContext
.
redirect
(
"/login"
);
}
}
maxkey-protocols/maxkey-protocol-saml-2.0/src/main/java/org/maxkey/authz/saml20/provider/endpoint/SingleSignOnEndpoint.java
浏览文件 @
f69e192a
...
...
@@ -122,58 +122,68 @@ public class SingleSignOnEndpoint {
extractBindingAdapter
.
buildSecurityPolicyResolver
(
trustKeyStore
);
}
@SuppressWarnings
(
"rawtypes"
)
public
void
extractSAMLMessage
(
ExtractBindingAdapter
extractBindingAdapter
,
HttpServletRequest
request
)
throws
Exception
{
SAMLMessageContext
messageContext
;
SAMLMessageContext
messageContext
;
logger
.
debug
(
"extract SAML Message ."
);
try
{
messageContext
=
extractBindingAdapter
.
extractSAMLMessageContext
(
request
);
logger
.
debug
(
"validate SAML AuthnRequest ."
);
AuthnRequest
authnRequest
=
(
AuthnRequest
)
messageContext
.
getInboundSAMLMessage
();
logger
.
debug
(
"AuthnRequest ProtocolBinding "
+
authnRequest
.
getProtocolBinding
());
logger
.
debug
(
"InboundSAMLMessage Id "
+
messageContext
.
getInboundSAMLMessageId
());
logger
.
debug
(
"AuthnRequest AssertionConsumerServiceURL "
+
authnRequest
.
getAssertionConsumerServiceURL
());
logger
.
debug
(
"InboundMessage Issuer "
+
messageContext
.
getInboundMessageIssuer
());
logger
.
debug
(
"InboundSAMLMessage IssueInstant "
+
messageContext
.
getInboundSAMLMessageIssueInstant
());
logger
.
debug
(
"InboundSAMLMessage RelayState "
+
messageContext
.
getRelayState
());
logger
.
debug
(
"AuthnRequest isPassive "
+
authnRequest
.
isPassive
());
logger
.
debug
(
"AuthnRequest ForceAuthn "
+
authnRequest
.
isForceAuthn
());
validatorSuite
.
validate
(
authnRequest
);
logger
.
debug
(
"Select Authz Binding."
);
String
binding
=
extractBindingAdapter
.
getSaml20Detail
().
getBinding
();
if
(
binding
.
endsWith
(
"PostSimpleSign"
)){
bindingAdapter
=
postSimpleSignBindingAdapter
;
logger
.
debug
(
"Authz POST Binding is use PostSimpleSign ."
);
}
else
{
bindingAdapter
=
postBindingAdapter
;
logger
.
debug
(
"Authz POST Binding is use Post ."
);
}
AuthnRequestInfo
authnRequestInfo
=
new
AuthnRequestInfo
(
authnRequest
.
getAssertionConsumerServiceURL
(),
authnRequest
.
getID
());
logger
.
debug
(
"AuthnRequest vefified. Forwarding to AuthnResponder"
,
authnRequestInfo
);
bindingAdapter
.
setAuthnRequestInfo
(
authnRequestInfo
);
bindingAdapter
.
setExtractBindingAdapter
(
extractBindingAdapter
);
String
relayState
=
request
.
getParameter
(
"RelayState"
);
if
(
relayState
!=
null
)
{
bindingAdapter
.
setRelayState
(
relayState
);
logger
.
debug
(
"RelayState : "
,
relayState
);
}
}
catch
(
MessageDecodingException
e1
)
{
logger
.
error
(
"Exception decoding SAML MessageDecodingException"
,
e1
);
throw
new
Exception
(
e1
);
}
catch
(
SecurityException
e1
)
{
logger
.
error
(
"Exception decoding SAML SecurityException"
,
e1
);
throw
new
Exception
(
e1
);
}
logger
.
debug
(
"validate SAML AuthnRequest ."
);
AuthnRequest
authnRequest
=
(
AuthnRequest
)
messageContext
.
getInboundSAMLMessage
();
try
{
validatorSuite
.
validate
(
authnRequest
);
}
catch
(
ValidationException
ve
)
{
logger
.
warn
(
"AuthnRequest Message failed Validation"
,
ve
);
throw
new
Exception
(
ve
);
}
logger
.
debug
(
"Select Authz Binding."
);
String
binding
=
extractBindingAdapter
.
getSaml20Detail
().
getBinding
();
if
(
binding
.
endsWith
(
"PostSimpleSign"
)){
bindingAdapter
=
postSimpleSignBindingAdapter
;
logger
.
debug
(
"Authz POST Binding is use PostSimpleSign ."
);
}
else
{
bindingAdapter
=
postBindingAdapter
;
logger
.
debug
(
"Authz POST Binding is use Post ."
);
}
AuthnRequestInfo
authnRequestInfo
=
new
AuthnRequestInfo
(
authnRequest
.
getAssertionConsumerServiceURL
(),
authnRequest
.
getID
());
logger
.
debug
(
"AuthnRequest vefified. Forwarding to AuthnResponder"
,
authnRequestInfo
);
bindingAdapter
.
setAuthnRequestInfo
(
authnRequestInfo
);
bindingAdapter
.
setExtractBindingAdapter
(
extractBindingAdapter
);
String
relayState
=
request
.
getParameter
(
"RelayState"
);
if
(
relayState
!=
null
)
{
bindingAdapter
.
setRelayState
(
relayState
);
logger
.
debug
(
"RelayState : "
,
relayState
);
}
}
catch
(
ValidationException
ve
)
{
logger
.
warn
(
"AuthnRequest Message failed Validation"
,
ve
);
throw
new
Exception
(
ve
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录