当前位置: 首页 > 知识库问答 >
问题:

居中

羊和光
2023-03-14

我正在尝试将支持SAML的应用程序作为SP连接到Mircrosoft Azure,并以IDP为中心。SSO(单点登录)可以正常工作,但我在完成一个完整的单点登录过程时遇到了一些问题。

当用户单击SP内的注销按钮时,将向IDP发送一个(有效)注销请求。IDP会话按预期终止,但浏览器不会重定向到SP以完成注销过程。似乎LogoutResponse完全不见了。

关于Centrify的更新
正如Centrify的Nick Gamb所说(见下面他的回答),目前Centrify不支持此功能,但将在未来实现它。

关于Azure的更新
您必须在注销请求中提供一个“wreply”参数,其中包含用户注销后应重定向到的网站的url_ecoded url:https://login.microsoftonline.com/common/wsfederation?wa=wsignout1.0

如果您使用的是Onelogin PHP工具包,那么还必须启用“retrieveParametersFromServer”设置,否则注销响应将始终以“签名验证失败”结束。“注销请求被拒绝”错误。

遵循SAML请求/响应(我允许自己删除证书信息…):

中心化//登录请求

<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                ID="ONELOGIN_17b5cbaaa30c8a9edca9935a320b0de3a4088fcc"
                Version="2.0"
                ProviderName="MYAPP"
                IssueInstant="2017-01-27T12:08:52Z"
                Destination="https://aap1234.my.centrify.com/applogin/appKey/1234567-1234-1234-1234-123456789/customerId/ABC0123"
                ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
                AssertionConsumerServiceURL="https://myapp.com/acs"
                >
<saml:Issuer>https://myapp.com/metadata</saml:Issuer>
<samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
                    AllowCreate="true"
                    />
<samlp:RequestedAuthnContext Comparison="exact">
    <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
</samlp:RequestedAuthnContext>

中心化//登录响应

<saml2p:Response ID="_7367bcc4-f4a1-4bf0-b845-ecaf0e7d6b86"
             InResponseTo="ONELOGIN_17b5cbaaa30c8a9edca9935a320b0de3a4088fcc"
             Version="2.0"
             IssueInstant="2017-01-27T12:08:53.978Z"
             Destination="https://myapp.com/acs"
             xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
             >
<Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">https://aap1234.my.centrify.com/1234567-1234-1234-1234-123456789</Issuer>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
    <SignedInfo>
        <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
        <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
        <Reference URI="#_7367bcc4-f4a1-4bf0-b845-ecaf0e7d6b86">
            <Transforms>
                <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
                <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
            </Transforms>
            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <DigestValue>EpN1bP9vKhLUUpyr0Hfnb3lM6gA=</DigestValue>
        </Reference>
    </SignedInfo>
    <SignatureValue>...</SignatureValue>
    <KeyInfo>
        <X509Data>
            <X509Certificate>...</X509Certificate>
        </X509Data>
    </KeyInfo>
</Signature>
<saml2p:Status>
    <saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
</saml2p:Status>
<Assertion Version="2.0"
           ID="_71ccde7d-6a7b-4b79-a6ed-1f8465b7a835"
           IssueInstant="2017-01-27T12:08:53.869Z"
           xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
           >
    <Issuer>https://aap1234.my.centrify.com/1234567-1234-1234-1234-123456789</Issuer>
    <Subject>
        <NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">centrify@myapp.com</NameID>
        <SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
            <SubjectConfirmationData NotOnOrAfter="2017-01-27T13:08:53.869Z"
                                     Recipient="https://myapp.com/acs"
                                     InResponseTo="ONELOGIN_17b5cbaaa30c8a9edca9935a320b0de3a4088fcc"
                                     />
        </SubjectConfirmation>
    </Subject>
    <Conditions NotBefore="2017-01-27T12:05:53.869Z"
                NotOnOrAfter="2017-01-27T13:08:53.869Z"
                >
        <AudienceRestriction>
            <Audience>https://myapp.com/metadata</Audience>
        </AudienceRestriction>
    </Conditions>
    <AuthnStatement AuthnInstant="2017-01-27T12:08:53.869Z"
                    SessionIndex="_71ccde7d-6a7b-4b79-a6ed-1f8465b7a835"
                    >
        <AuthnContext>
            <AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</AuthnContextClassRef>
        </AuthnContext>
    </AuthnStatement>
    <AttributeStatement>
        <Attribute Name="firstname"
                   NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
                   >
            <AttributeValue>Firstname</AttributeValue>
        </Attribute>
        <Attribute Name="lastname"
                   NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
                   >
            <AttributeValue>Lastname</AttributeValue>
        </Attribute>
        <Attribute Name="emailaddress"
                   NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
                   >
            <AttributeValue>centrify@myapp.com</AttributeValue>
        </Attribute>
        <Attribute Name="groups"
                   NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
                   >
            <AttributeValue>group1,group2</AttributeValue>
        </Attribute>
    </AttributeStatement>
</Assertion>

中心化//注销请求

<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                 xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                 ID="ONELOGIN_dc16bcf1e9a5de948d336fbca93d4a5718b56f3d"
                 Version="2.0"
                 IssueInstant="2017-01-27T12:10:12Z"
                 Destination="https://aap1234.my.centrify.com/applogout"
                 >
<saml:Issuer>https://myapp.com/metadata</saml:Issuer>
<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">centrify@myapp.com</saml:NameID>
<samlp:SessionIndex>_71ccde7d-6a7b-4b79-a6ed-1f8465b7a835</samlp:SessionIndex>

Microsoft Azure//登录请求

<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                ID="ONELOGIN_40becfa9c4dc2697c9778b7b598399fbc55cef98"
                Version="2.0"
                ProviderName="MYAPP"
                IssueInstant="2017-01-27T12:31:26Z"
                Destination="https://login.microsoftonline.com/1234567-1234-1234-1234-123456789/saml2"
                ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
                AssertionConsumerServiceURL="https://myapp.com/acs"
                >
<saml:Issuer>https://myapp.com/metadata</saml:Issuer>
<samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
                    AllowCreate="true"
                    />
<samlp:RequestedAuthnContext Comparison="exact">
    <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
</samlp:RequestedAuthnContext>

Microsoft Azure//登录响应

<samlp:Response ID="_4221c6ce-51b5-48df-b33e-5c601bbc22ad"
            Version="2.0"
            IssueInstant="2017-01-27T12:31:27.170Z"
            Destination="https://myapp.com/acs"
            InResponseTo="ONELOGIN_40becfa9c4dc2697c9778b7b598399fbc55cef98"
            xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
            >
<Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">https://sts.windows.net/1234567-1234-1234-1234-123456789/</Issuer>
<samlp:Status>
    <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
</samlp:Status>
<Assertion ID="_ad52e38a-5f8f-4a60-9b3b-d904afd9b82e"
           IssueInstant="2017-01-27T12:31:27.170Z"
           Version="2.0"
           xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
           >
    <Issuer>https://sts.windows.net/1234567-1234-1234-1234-123456789/</Issuer>
    <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/2001/04/xmldsig-more#rsa-sha256" />
            <ds:Reference URI="#_ad52e38a-5f8f-4a60-9b3b-d904afd9b82e">
                <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/2001/04/xmlenc#sha256" />
                <ds:DigestValue>mv1wKPg7iHLzZ5cNnu8oYX0/YvZqGsxKHsUc0umZVYw=</ds:DigestValue>
            </ds:Reference>
        </ds:SignedInfo>
        <ds:SignatureValue>...</ds:SignatureValue>
        <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
            <X509Data>
                <X509Certificate>...</X509Certificate>
            </X509Data>
        </KeyInfo>
    </ds:Signature>
    <Subject>
        <NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">jMPrg5XmAUzfnoCKSAXJGJMDZ8Hdj_bRU2YY6-Ozugg</NameID>
        <SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
            <SubjectConfirmationData InResponseTo="ONELOGIN_40becfa9c4dc2697c9778b7b598399fbc55cef98"
                                     NotOnOrAfter="2017-01-27T12:36:27.170Z"
                                     Recipient="https://myapp.com/acs"
                                     />
        </SubjectConfirmation>
    </Subject>
    <Conditions NotBefore="2017-01-27T12:26:27.154Z"
                NotOnOrAfter="2017-01-27T13:26:27.154Z"
                >
        <AudienceRestriction>
            <Audience>https://myapp.com/metadata</Audience>
        </AudienceRestriction>
    </Conditions>
    <AttributeStatement>
        <Attribute Name="http://schemas.microsoft.com/identity/claims/tenantid">
            <AttributeValue>1234567-1234-1234-1234-123456789</AttributeValue>
        </Attribute>
        <Attribute Name="http://schemas.microsoft.com/identity/claims/objectidentifier">
            <AttributeValue>12345-123-123-1234-12345678</AttributeValue>
        </Attribute>
        <Attribute Name="http://schemas.microsoft.com/identity/claims/identityprovider">
            <AttributeValue>live.com</AttributeValue>
        </Attribute>
        <Attribute Name="firstname">
            <AttributeValue>Firstname</AttributeValue>
        </Attribute>
        <Attribute Name="lastname">
            <AttributeValue>Lastname</AttributeValue>
        </Attribute>
        <Attribute Name="emailaddress">
            <AttributeValue>mail@myapp.com</AttributeValue>
        </Attribute>
    </AttributeStatement>
    <AuthnStatement AuthnInstant="2017-01-27T11:09:28.000Z"
                    SessionIndex="_ad52e38a-5f8f-4a60-9b3b-d904afd9b82e"
                    >
        <AuthnContext>
            <AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</AuthnContextClassRef>
        </AuthnContext>
    </AuthnStatement>
</Assertion>

Microsoft Azure//注销请求

<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                 xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
                 ID="ONELOGIN_a90edfe3da4eb07dd1e2a52df7d4cb5385cbd6c8"
                 Version="2.0"
                 IssueInstant="2017-01-27T12:32:05Z"
                 Destination="https://login.microsoftonline.com/common/wsfederation?wa=wsignout1.0"
                 >
<saml:Issuer>https://myapp.com/metadata</saml:Issuer>
<saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">jMPrg5XmAUzfnoCKSAXJGJMDZ8Hdj_bRU2YY6-Ozugg</saml:NameID>
<samlp:SessionIndex>_ad52e38a-5f8f-4a60-9b3b-d904afd9b82e</samlp:SessionIndex>

Signout请求随其他GET参数发送:RelayState

我针对第三个IDP(Onelogin)测试了SP配置,这里SP启动的注销工作正常。将用户从IDP会话中注销,然后使用LogoutSolutions重定向到SP。这里唯一的区别是,我能够在Onelogin应用程序配置中显式设置SP注销网址。

是否可以在Azure或Centrify中定义SP注销url?我错过什么了吗?

谢谢

共有2个答案

陈允晨
2023-03-14

谢谢你提交你的问题。这是最近一个常见的问题。简而言之,Centrify目前不支持SAML单点登出。Centrify中SAML应用的注销URL只是对IDP的注销请求。之后,用户总是被重定向到Centrify登录页面。其中没有SAML支持,因此没有响应。

好消息是,这个功能目前正在解决,应该在未来的产品构建中发布到完整的SAML规范。在那之前,我有一个可能的解决方案供你考虑。

如果您能够修改web应用程序,特别是它如何进行注销调用,那么您可以设置逻辑,将对注销URL的注销调用设置为API调用,而不是重定向。您需要从站点Javascript调用注销URL,以便在API调用中传递用户会话cookie,就像从服务器代码调用一样。这样做时,您可以将用户从Centrify注销,然后将其重定向到您希望他们最终登录的任何页面(即您的web应用程序登录页面)。该调用不需要任何JSON。只需让一个web请求调用注销url,然后将用户重定向到您的登录页面。

请随时与我联系devsupport@centrify.com我很乐意进一步帮助你。我也很高兴打电话来更详细地讨论这个问题。

非常感谢。

Nick Gamb开发者倡导者集中

裴心水
2023-03-14

正如我在更新的问题中已经提到的:

如果您使用的是Centrify

正如Centrify的Nick Gamb所说(参见上面的答案),目前Centrify不支持此功能,但将在将来实现。

如果使用的是Microsoft Azure

您必须在注销请求中提供一个“wreply”参数,其中包含用户注销后应重定向到的网站的url_ecoded url:https://login.microsoftonline.com/common/wsfederation?wa=wsignout1.0

如果您使用的是Onelogin PHP工具包,那么还必须启用“retrieveParametersFromServer”设置,否则注销响应将始终以“签名验证失败”结束。“注销请求被拒绝”错误。

 类似资料:
  • 问题内容: 我有一个div 。其内容水平和垂直居中。 当div中的内容太长时,内容将自动换行。但是在这种情况下,对齐方式会中断。请参阅摘要。 如果我添加正确显示。但是,为什么没有中心呢? 问题答案: flex容器的HTML结构具有三个级别: 容器 该项目 内容 每个级别代表一个独立的独立元素。 该属性是在flex容器上设置的,用于控制flex项目。它不能直接控制项目的子项(在这种情况下为文本)。

  • 问题内容: 我有一个非常简单的问题,但似乎无法解决。我在div中有一个表格,这是主要元素。现在,我在表内有一个td标签,其宽度和高度设置为iphone屏幕尺寸。现在,我基本上要将该表及其td单元格放在div标签的中心,以便“屏幕”将在任何浏览器窗口中居中。我怎么做? 用表替换该div解决了我的问题,但我想改用div。 谢谢 问题答案: 试试这个,我做这个代码-演示在这里,非常简单的代码(我仅对IE

  • 本文向大家介绍Laravel 移居,包括了Laravel 移居的使用技巧和注意事项,需要的朋友参考一下 示例 在Laravel中控制数据库是通过使用迁移。使用工匠创建迁移: 这将生成类CreateFirstTable。在up方法内,您可以创建列: 最后,要运行所有迁移类,您可以运行artisan命令: 这将在数据库中创建表和列。其他有用的迁移命令是: php artisan migrate:rol

  • 问题内容: 我怎么能垂直居中内的? 到目前为止,我的代码: 我已经尝试过“ top:50%”;和“ vertical-align:middle”;没有成功 编辑: 好的,所以已经讨论了很多。我也许已经开始了另一场小型的火焰战争。但是为了论证,那我该如何用一个表呢?到目前为止,我已经将CSS用于其他所有内容,所以这并不是说我没有尝试采用“良好做法”。 编辑: 内部div没有固定的高度 问题答案: 简

  • 我正在尝试居中我的页面容器,同时保持一个左对齐的内容。 我最初尝试使用flexbox,但遇到了一些问题,所以它有些复杂。 主包装容器居中,但内部的容器不居中 这在FlexBox中是可能的吗?为什么容器不居中,甚至当我告诉它证明居中? 链接到笔:https://codepen.io/jacksonrose/pen/rwnbmmm 主包装容器居中,但内部的容器不居中

  • 本文向大家介绍如何垂直居中` `?相关面试题,主要包含被问及如何垂直居中` `?时的应答技巧和注意事项,需要的朋友参考一下 使用协助元素(这里是i),作为img的相邻元素,同为inline-block的两元素相邻时增加vertical-align: middle