代码之家  ›  专栏  ›  技术社区  ›  Rakesh Chouhan

无法从sharepoint获取访问令牌

  •  0
  • Rakesh Chouhan  · 技术社区  · 6 年前

    我正在尝试使用以下步骤从共享点获取访问令牌-

    URL-发布 https://login.microsoftonline.com/extSTS.srf

    标题-

    Accept:application/json; odata=详细 内容-Type:text/xml; 字符集=utf-8

    <?xml version="1.0" encoding="utf-8" ?>
    
    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <s:Header>
            <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</a:Action>
            <a:ReplyTo>
                <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
            </a:ReplyTo>
            <a:To s:mustUnderstand="1">https://login.microsoftonline.com/extSTS.srf</a:To>
            <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                <o:UsernameToken>
                    <o:Username>myusername</o:Username>
                    <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</o:Password>
                </o:UsernameToken>
            </o:Security>
        </s:Header>
        <s:Body>
            <t:RequestSecurityToken xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
                <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
                    <a:EndpointReference>
                        <a:Address>https://mysharepoint.sharepoint.com</a:Address>
                    </a:EndpointReference>
                </wsp:AppliesTo>
                <t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType>
                <t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
                <t:TokenType>urn:oasis:names:tc:SAML:1.0:assertion</t:TokenType>
            </t:RequestSecurityToken>
        </s:Body>
    </s:Envelope>
    

    我得到了回应-

    <?xml version="1.0" encoding="utf-8"?>
    <S:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:S="http://www.w3.org/2003/05/soap-envelope">
        <S:Header>
            <wsa:Action S:mustUnderstand="1" wsu:Id="Action">http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue</wsa:Action>
            <wsa:To S:mustUnderstand="1" wsu:Id="To">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
            <wsse:Security S:mustUnderstand="1">
                <wsu:Timestamp wsu:Id="TS" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                    <wsu:Created>2019-12-13T10:20:03.4038542Z</wsu:Created>
                    <wsu:Expires>2019-12-13T10:25:03.4038542Z</wsu:Expires>
                </wsu:Timestamp>
            </wsse:Security>
        </S:Header>
        <S:Body xmlns:S="http://www.w3.org/2003/05/soap-envelope">
            <wst:RequestSecurityTokenResponse xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust">
                <wsp:AppliesTo>
                    <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
                        <wsa:Address>https://mysharepoint.sharepoint.com</wsa:Address>
                    </wsa:EndpointReference>
                </wsp:AppliesTo>
                <psf:pp xmlns:psf="http://schemas.microsoft.com/Passport/SoapServices/SOAPFault">
                    <psf:reqstatus>0x8004882c</psf:reqstatus>
                    <psf:errorstatus>0x80045b00</psf:errorstatus>
                </psf:pp>
            </wst:RequestSecurityTokenResponse>
        </S:Body>
    </S:Envelope>
    

    我正在遵循博客中提到的步骤

    https://paulryan.com.au/2014/spo-remote-authentication-rest/

    0 回复  |  直到 6 年前
    推荐文章