为 SP 生成 OpenSaml 元数据
Generating OpenSaml MetaData for a SP
我正在尝试使用 SAML2 实现 SSO,并且我的应用程序是多租户的并且充当 SP。我目前正在致力于生成 SP 元数据,但我有点卡在加密方面,似乎找不到任何示例,除了 Stefan Rasmusson 已经推出的内容(我什至买了他的书),但是 none 其中似乎涵盖了元数据的生成。我的问题是,对于元数据中包含的 public 键,生成这些键的最佳方法是什么。我应该使用现有的 jks 来签署我的其余消息,即:authnrequests 等,或者这些密钥应该是单独的,并且密钥应该是唯一的以验证签名还是加密数据?我有点迷路,找不到太多文档,所以我们将不胜感激。我看过这个 post: http://blog.samlsecurity.com/2012/02/generating-metadata-with-opensaml.html 但看起来他正在即时生成密钥,这在制作中不会真正起作用。在此先感谢您的帮助!
在制作中,您当然不会即时生成密钥。您必须向 IDP 注册您的 SP 元数据,这样就不会轻易工作(除非 IDP 在您的控制之下)。
允许 SP to have two private keys,签名一个,encryption/decryption一个,但这不是强制性的。我遇到的大多数生产案例,两者都使用相同的密钥。希望对您有所帮助。
您似乎已经完成了 Shibboleth SP 设置,因此此答案的其余部分似乎没有必要。但为了完整起见,以下是获得工作 Shibboleth SP 的步骤。
- 获取或构建私钥存储和证书。这可以是自签名的或来自 CA
- 为 SP 创建元数据文件并将其注册到联盟。 "signing" 和 "encryption" 部分的条目将包含在上一步中获得的证书。
- 为 SP 将接受的各种 SAML 绑定指定 AssertionConsumerService url。 IDP 将发回对这些 url 之一的响应
示例 SP 元数据 xml 文档如下所示:
<md:EntityDescriptor entityID="https://mysp.example.com/shibboleth-sp" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata">
<md:SPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:1.1:protocol urn:oasis:names:tc:SAML:2.0:protocol" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata">
<md:KeyDescriptor use="signing">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:KeyName>mysp.example.com</ds:KeyName>
<ds:X509Data>
<ds:X509Certificate xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
REPLACE_ENTITY_ID_AND_ACS_URL_AND_PUT_YOUR_CERTIFICATE_HERE
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
<md:KeyDescriptor use="encryption">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:KeyName>mysp.example.com</ds:KeyName>
<ds:X509Data>
<ds:X509Certificate xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
REPLACE_ENTITY_ID_AND_ACS_URL_AND_PUT_YOUR_CERTIFICATE_HERE
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://mysp.example.com/shibboleth/Shibboleth.sso/SAML2/POST" index="1"/>
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact" Location="http://mysp.example.com/shibboleth/Shibboleth.sso/SAML2/Artifact" index="2"/>
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:1.0:profiles:artifact-01" Location="http://mysp.example.com/shibboleth/Shibboleth.sso/SAML/Artifact" index="3"/>
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:1.0:profiles:browser-post" Location="http://mysp.example.com/shibboleth/Shibboleth.sso/SAML/POST" index="4"/>
</md:SPSSODescriptor>
</md:EntityDescriptor>
我正在尝试使用 SAML2 实现 SSO,并且我的应用程序是多租户的并且充当 SP。我目前正在致力于生成 SP 元数据,但我有点卡在加密方面,似乎找不到任何示例,除了 Stefan Rasmusson 已经推出的内容(我什至买了他的书),但是 none 其中似乎涵盖了元数据的生成。我的问题是,对于元数据中包含的 public 键,生成这些键的最佳方法是什么。我应该使用现有的 jks 来签署我的其余消息,即:authnrequests 等,或者这些密钥应该是单独的,并且密钥应该是唯一的以验证签名还是加密数据?我有点迷路,找不到太多文档,所以我们将不胜感激。我看过这个 post: http://blog.samlsecurity.com/2012/02/generating-metadata-with-opensaml.html 但看起来他正在即时生成密钥,这在制作中不会真正起作用。在此先感谢您的帮助!
在制作中,您当然不会即时生成密钥。您必须向 IDP 注册您的 SP 元数据,这样就不会轻易工作(除非 IDP 在您的控制之下)。
允许 SP to have two private keys,签名一个,encryption/decryption一个,但这不是强制性的。我遇到的大多数生产案例,两者都使用相同的密钥。希望对您有所帮助。
您似乎已经完成了 Shibboleth SP 设置,因此此答案的其余部分似乎没有必要。但为了完整起见,以下是获得工作 Shibboleth SP 的步骤。
- 获取或构建私钥存储和证书。这可以是自签名的或来自 CA
- 为 SP 创建元数据文件并将其注册到联盟。 "signing" 和 "encryption" 部分的条目将包含在上一步中获得的证书。
- 为 SP 将接受的各种 SAML 绑定指定 AssertionConsumerService url。 IDP 将发回对这些 url 之一的响应
示例 SP 元数据 xml 文档如下所示:
<md:EntityDescriptor entityID="https://mysp.example.com/shibboleth-sp" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata">
<md:SPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:1.1:protocol urn:oasis:names:tc:SAML:2.0:protocol" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata">
<md:KeyDescriptor use="signing">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:KeyName>mysp.example.com</ds:KeyName>
<ds:X509Data>
<ds:X509Certificate xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
REPLACE_ENTITY_ID_AND_ACS_URL_AND_PUT_YOUR_CERTIFICATE_HERE
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
<md:KeyDescriptor use="encryption">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:KeyName>mysp.example.com</ds:KeyName>
<ds:X509Data>
<ds:X509Certificate xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
REPLACE_ENTITY_ID_AND_ACS_URL_AND_PUT_YOUR_CERTIFICATE_HERE
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://mysp.example.com/shibboleth/Shibboleth.sso/SAML2/POST" index="1"/>
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact" Location="http://mysp.example.com/shibboleth/Shibboleth.sso/SAML2/Artifact" index="2"/>
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:1.0:profiles:artifact-01" Location="http://mysp.example.com/shibboleth/Shibboleth.sso/SAML/Artifact" index="3"/>
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:1.0:profiles:browser-post" Location="http://mysp.example.com/shibboleth/Shibboleth.sso/SAML/POST" index="4"/>
</md:SPSSODescriptor>
</md:EntityDescriptor>