- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我必须为 Salesforce 创建单点登录 (SSO)。为了进行授权,我将使用用户的手机号码和 OTP。我只需在验证 OTP 后使用 Go 创建 SAML 响应。
我可以看到有几个库可以实现 go-saml , gosaml , go-oauth和 goauth Go 编程语言,但即使经过几个小时的搜索,我也无法决定哪一种适合我。我不必实现完整的 IDP,我只需动态创建 SAML 响应。
我找到了需要从 https://www.samltool.com/generic_sso_res.php 创建的 XML 响应模板。所以我必须创建如下所示的 SAML 响应:-
<?xml version="1.0" encoding="UTF-8"?>
<saml1p:Response xmlns:saml1p="urn:oasis:names:tc:SAML:1.0:protocol" IssueInstant="2020-02-26T17:32:05.200Z" MajorVersion="1" MinorVersion="1" Recipient="https://im--partial.my.salesforce.com" ResponseID="_34ae7ce8-5f7fbd4d">
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1"/>
<ds:Reference URI="#_34ae7ce8-5f7fbd4d">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>fxk4drd6yhVQrJCtdfvYOyYYGAM=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>EsjQYhFsL+Xvcgg59AkZja....8INZrTwyfLmo4+NMyYViDX6Q==</ds:SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>MIID0zCCA5GgAwIBAgIEF...XWlGzJ3SdBlgRsdFgKyFtcxE=</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</ds:Signature>
<saml1p:Status>
<saml1p:StatusCode Value="saml1p:Success"/>
</saml1p:Status>
<saml1:Assertion xmlns:saml1="urn:oasis:names:tc:SAML:1.0:assertion" AssertionID="_7f959448-5dbf311f" IssueInstant="2020-02-26T17:32:05.200Z" Issuer="AXIOM" MajorVersion="1" MinorVersion="1">
<saml1:Conditions NotBefore="2020-02-26T17:32:05.199Z" NotOnOrAfter="2020-02-26T17:33:05.199Z">
<saml1:AudienceRestrictionCondition>
<saml1:Audience>https://saml.salesforce.com</saml1:Audience>
</saml1:AudienceRestrictionCondition>
</saml1:Conditions>
<saml1:AuthenticationStatement AuthenticationInstant="2020-02-26T17:32:05.199Z" AuthenticationMethod="urn:oasis:names:tc:SAML:1.0:am:unspecified">
<saml1:Subject>
<saml1:NameIdentifier>rahul.satal@xyz.com</saml1:NameIdentifier>
<saml1:SubjectConfirmation>
<saml1:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer</saml1:ConfirmationMethod>
</saml1:SubjectConfirmation>
</saml1:Subject>
</saml1:AuthenticationStatement>
</saml1:Assertion>
</saml1p:Response>
其中我只需要更新几个参数,例如 Assertion_Id、Issertion_Id、Issuer、Audience、Recipient、Subject、Not before/After date、Attribute statements 等。我不确定是否需要任何库或可以获得一个单个脚本。
最佳答案
This library似乎是一个简单的 Go 的 SAML
库,负责生成 SAML
Response
以及对该 Response
进行签名.
我还看到过使用"template"完成此操作,但实际上并未完成任何 SAML
处理。打开准备好的带有占位符的文本 block ,将占位符替换为所需的文本并发送响应。
saml1p:Response
可以是在运行时创建的带有 IssueInstant
和 ResponseID
的模板。例如伪代码将是:
String samlTemplate = loadSAMLTemplate()
.gsub("__IssueInstant__", "2020-02-26T17:32:05.200Z")
.gsub("__ResponseID__", "9421878f98")
.gsub( ... and so on ...)
即使不理想,也可以这样做,并且只有在只有一个断言
时才有效。
您可以使用上面的模板并用占位符替换可替换的部分,例如
<saml1p:Response
xmlns:saml1p="urn:oasis:names:tc:SAML:1.0:protocol"
IssueInstant="__IssueInstant__"
MajorVersion="1"
MinorVersion="1"
Recipient="https://im--partial.my.salesforce.com"
ResponseID="__ResponseID__">
构建XML
SAML
响应
。您将拥有用于 AssertionID
等的占位符。任何需要每个 SAML
唯一的内容 Response
都需要一个占位符,其内容在运行时替换.
然后您需要签署该响应
。你不能通过更换东西来做到这一点。您只能通过使用 XML 签名进行数字签名来完成此操作。您可以使用 this library要做到这一点。它仍在对响应
进行编码,但您只需使用签名,而不是整个SAML
流程。
所以工作流程是:
SAML
Response
作为文本模板,并为每个可替换文本添加 PlaceHolders。SAML
响应
。SAML
响应
进行签名。这是您发送给 SP 的内容。关于go - 无法从 IDP 创建 SAML 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60430587/
阅读自 http://en.wikipedia.org/wiki/SAML_2.0 ,我试图了解保证在流程的第 5 步中发送的 SAMLResponse 的真实性的机制。 根据我的理解,SAML 的设
是否可以在 SAML 身份验证请求中发送属性? https://sp.example.com/SAML2 最佳答案 从技术上讲,是的,这是可能的,因为 AuthnRequest 可
在阅读了一些文章和引用资料后,我发现它们实际上说明了什么是 SAML,它包含哪些组件,它是如何工作的。一些不错的链接如下: Good documentation about Shibboleth an
我看过一堆关于如何通过重定向在身份提供商 (IdP)、服务提供商 (SP) 和浏览器之间传递的流程图。然而,现在对我来说似乎没有必要,所以我知道我错过了一些东西。 有人可以向我提供一个使用案例,其中与
我需要在 SAML 请求中添加一个请求参数(例如 locale=en),以便让登录页面显示正确的语言。我怎么做? 我试图将属性添加到作为参数发送到开始方法 (SamlEntryPoint) 的 Htt
我在将我的应用程序与 SAML 集成时遇到问题。 以下是我的错误: org.springframework.security.saml.SAMLProcessingFilter.attemptAuth
我是 SAML 的新手,对预期的签名和信任过程感到困惑。 我正在编写一个 SP 并从 IDP 接收到一个签名的 samlp:Response,其中包括 KeyInfo:
ADFS 具有看似错误的意外行为。 我有使用 SHA1 哈希算法进行数字签名的 SP。 在此 SP 的 ADFS 上,我在高级选项卡上设置为使用 SHA256。 对我来说,这些不相关是正常的,每一方选
我正在使用 SAML 登录我的应用程序,我想在登录响应断言的属性中包含用户组。我想知道登录请求是否应指定该属性是必需的,或者这是一般需要在 IDP 上完成的配置,还是在专门为我的服务提供商的 IDP
我的任务是设计一个非常简单的 SSO(单点登录)流程。我的雇主已指定它应该在 SAML 中实现。我想在确认 SAML 规范的同时创建尽可能简单的消息。 如果你们中的一些人能查看我的请求和响应消息,并告
我们正在使用ruby-saml将我们的应用程序建立为服务提供商,同时使用 Google 作为身份提供商,尽管我不认为这个问题特定于 Ruby 或该项目。 我见过this answer from the
我们正在使用ruby-saml将我们的应用程序建立为服务提供商,同时使用 Google 作为身份提供商,尽管我不认为这个问题特定于 Ruby 或该项目。 我见过this answer from the
有人建议 SAML token 应该有效多长时间(在 SOA 基础架构中)?我想到了几个 (6-12) 小时。 非常感谢马库斯 最佳答案 让您的 token 拥有如此长的生命周期通常不是一个好主意,因
我对 SAML 证书的这个概念很陌生。 我目前正在为网站配置 SSO,需要知道如何生成 SAML 证书?我为本网站使用的设置不是通过 Azure,而是直接来自供应商网站,他们正在请求我的 SAML 证
我是 SAML 的新手。您能否用简单的英语解释一下什么是 SAML 配置文件和绑定(bind),并提供几个示例。 最佳答案 nrathus 在他的评论中指出,维基百科的 entry on SAML是一
我在 Keycloak Server 4.2.1 中使用 saml 协议(protocol)注销时遇到问题。在 Keycloak 旁边有一个 Wildfly 9 服务器。在 Wildfly 服务器中部
有人能解释一下 和有什么区别吗?收件人和 观众 在 SAML 2.0 中? 我在这里从 OneLogin 中找到了非常模糊的解释: https://support.onelogin.com/hc/en
我知道在 SAML 协议(protocol)中,IDP 和 SP 他们拥有自己的 key 对,并且不会将他们的私钥暴露给对方。 我假设下面的领域 key 是 IDP key 对,这是有道理的,因为私钥
场景: 浏览器(用户)向服务提供商 (SP) 请求资源。 SP 重定向(通过 SAML 请求)到身份提供商 (IdP)。 由于是首次登录,用户会向 (IdP) 提供他/她的有效凭据。 然后,IdP 将
JWT(Json Web Token)和 SAML 的主要区别是什么?请向我推荐任何带有 Spring 安全性的示例。提前致谢。 最佳答案 两个SAML和 JWT是不依赖于任何编程语言的安全 toke
我是一名优秀的程序员,十分优秀!