【问题标题】:Endpoint when using AD FS SAML token with with SharePoint 2019将 AD FS SAML 令牌与 SharePoint 2019 一起使用时的终结点
【发布时间】:2022-11-06 11:17:30
【问题描述】:

我已经从 AD FS 获取了一个 SAML 令牌,用于我使用本地 SharePoint 服务器设置的依赖方信任。

下面给出了 ADFS 响应的重要部分。

使用它,我已经能够通过发布一个从 SharePoint 检索访问令牌url 编码形式http://mylocalsharepoint/_trust/default.aspx 并获取 set-cookie - 本质上是模拟登录 UI 的操作。

我的问题是,除了http://mylocalsharepoint/_trust/default.aspx(这是登录 GUI 页面使用的)之外,是否还有更好的端点,因为这将返回整个网页,但我真正需要的是访问令牌(fedAuth cookie)加上它需要一个 url -encoded-form - 如果能够只使用 XML SOAP 消息或至少使用 XML,那就太好了。

我找到了/_vti_bin/authentication.asmx,但这似乎只支持用户名和密码模式。

我真的很感激有人指出我正确的方向。非常感谢。

<trust:RequestSecurityTokenResponse>
    <trust:Lifetime>
        <wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2022-10-19T16:56:36.105Z</wsu:Created>
        <wsu:Expires xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2022-10-19T17:56:36.105Z</wsu:Expires>
    </trust:Lifetime>
    <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
        <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
            <wsa:Address>urn:sharepoint:spsites</wsa:Address>
        </wsa:EndpointReference>
    </wsp:AppliesTo>
    <trust:RequestedSecurityToken>
        <saml:Assertion MajorVersion="1" MinorVersion="1" AssertionID="_3519cbe0-66fb-4bc3-9a40-91ea06cb0ad7" Issuer="http://ms-adfs.intranet/adfs/services/trust" IssueInstant="2022-10-19T16:56:36.230Z" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion">
            <saml:Conditions NotBefore="2022-10-19T16:56:36.105Z" NotOnOrAfter="2022-10-19T17:56:36.105Z">
                <saml:AudienceRestrictionCondition>
                    <saml:Audience>urn:sharepoint:spsites</saml:Audience>
                </saml:AudienceRestrictionCondition>
            </saml:Conditions>
            <saml:AttributeStatement>
                <saml:Subject>
                    <saml:SubjectConfirmation>
                        <saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer</saml:ConfirmationMethod>
                    </saml:SubjectConfirmation>
                </saml:Subject>
                <saml:Attribute AttributeName="emailaddress" AttributeNamespace="http://schemas.xmlsoap.org/ws/2005/05/identity/claims">
                    <saml:AttributeValue>billbates@microsotofu.com</saml:AttributeValue>
                </saml:Attribute>
            </saml:AttributeStatement>
            <saml:AuthenticationStatement AuthenticationMethod="urn:oasis:names:tc:SAML:1.0:am:X509-PKI" AuthenticationInstant="2022-10-19T16:56:35.639Z">
                <saml:Subject>
                    <saml:SubjectConfirmation>
                        <saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer</saml:ConfirmationMethod>
                    </saml:SubjectConfirmation>
                </saml:Subject>
            </saml:AuthenticationStatement>
            <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="#_3519cbe0-66fb-4bc3-9a40-91ea06cb0ad7">
                        <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>gTz6J3z40UUkqOf1DV3gAe4yel5AD0GVPCJ7xI6ac44=</ds:DigestValue>
                    </ds:Reference>
                </ds:SignedInfo>
                <ds:SignatureValue>ftyI5grqS01/g9zpfUuPn24xXMvJ...</ds:SignatureValue>
                <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
                    <X509Data>
                        <X509Certificate>MIICxDCCAaygAwIBAgIQEqN9pL4STbx...</X509Certificate>
                    </X509Data>
                </KeyInfo>
            </ds:Signature>
        </saml:Assertion>
    </trust:RequestedSecurityToken>
    <trust:TokenType>urn:oasis:names:tc:SAML:1.0:assertion</trust:TokenType>
    <trust:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</trust:RequestType>
    <trust:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer</trust:KeyType>
</trust:RequestSecurityTokenResponse>

【问题讨论】:

标签: c# sharepoint saml adfs sharepoint-2019


【解决方案1】:

您需要开发 C# 自定义作为农场解决方案,以在 SharePoint 端包含一个自定义端点,例如准备接收上面给定 XML 合同并重定向到这个新自定义端点的 ASHX,C# 代码需要最少的三件事:

  1. 使用CORS方法保证安全;
  2. 反序列化从自定义身份验证提供程序接收到的 XML;
  3. 最后一个:将自定义授权开发到 SharePoint 端;

    关于第 3 项,推荐这个 Microsoft Learn 主题:Create a claims provider in SharePoint

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-02
    • 2021-10-22
    • 2015-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多