【问题标题】:Generating OpenSaml MetaData for a SP为 SP 生成 OpenSaml 元数据
【发布时间】:2015-09-15 12:19:31
【问题描述】:

我正在尝试使用 SAML2 实现 SSO,并且我的应用程序是多租户并充当 SP。我目前正在生成 SP 元数据,但我有点卡在加密方面,似乎找不到任何例子,除了 Stefan Rasmusson 放在那里的东西(我什至买了他的书),但没有一个它似乎涵盖了元数据的生成。我的问题是,对于元数据中包含的公钥,生成这些公钥的最佳方式是什么。我应该使用现有的 jks 来签署我的其余消息,即:authnrequests 等,还是这些密钥应该是单独的,并且密钥对于验证签名和加密数据是否应该是唯一的?我有点迷茫,并且找不到太多文档,因此将不胜感激。我看过这篇文章:http://blog.samlsecurity.com/2012/02/generating-metadata-with-opensaml.html 但似乎他正在动态生成密钥,这在生产中不会真正起作用。提前感谢您的帮助!

【问题讨论】:

    标签: java cryptography opensaml


    【解决方案1】:

    在制作中,您当然不会即时生成密钥。您必须向 IDP 注册您的 SP 元数据,这样就不容易工作(除非 IDP 在您的控制范围内)。

    SP to have two private keys 是允许的,一个用于签名,一个用于加密/解密,但这不是强制性的。我遇到的大多数生产案例,两者都使用相同的密钥。我希望这会有所帮助。

    您似乎已经完成了 Shibboleth SP 设置,因此此答案的其余部分似乎没有必要。但为了完整起见,以下是获得工作 Shibboleth SP 的步骤。

    • 获取或构建私钥存储和证书。这可以是自签名的,也可以来自 CA
    • 为 SP 创建元数据文件并将其注册到联合。 “签名”和“加密”部分的条目将包含在上一步中获得的证书。
    • 为 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>        
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-25
      • 2016-09-01
      • 2017-02-25
      • 2016-06-03
      • 1970-01-01
      • 2015-02-03
      • 2013-09-09
      • 1970-01-01
      相关资源
      最近更新 更多