使用REST进行远程身份验证

金克斯

我正在尝试使用REST API远程访问SharePoint 已为该站点启用Office 365智能链接根据博客,我没有收到wsse\\:BinarySecurityToken回复。我的代码如下:

$.ajax({
'url': 'https://sts.something.com/adfs/ls/?&wa=wsignin1.0&wtrealm=urn:federation:MicrosoftOnline&wctx=wa%3Dwsignin1.0%26rpsnv%3D4%26ct%3D1417151170%26rver%3D6.1.6206.0%26wp%3DMBI%26wreply%3Dhttps:%252F%252Fsomethingonline.sharepoint.com%252F_forms%252Fdefault.aspx%26lc%3D16393%26id%3D500046%26bk%3D1417151171%26LoginOptions%3D3',
           dataType: 'text',
     type:'POST',
'data': '<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:MessageID>urn:uuid:40c1407d-b2a4-4e05-8248-8a92b71102b6</a:MessageID><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"><u:Timestamp u:Id="_0"><u:Created>2012-07-26T16:13:00.622Z</u:Created><u:Expires>2012-07-26T16:18:00.622Z</u:Expires></u:Timestamp><o:UsernameToken u:Id="uuid-69882db9-2d6b-45d3-b016-c2156cb6c01d-1"><o:Username>[email protected]</o:Username><o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">*********</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://somthingonline.sharepoint.com/_forms/default.aspx?wa=wsignin1.0</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>',
          headers: {
        Accept : "application/soap+xml; charset=utf-8"
    },
    success: function(result, textStatus, jqXHR) {
        console.log('done in login ');
        console.log('result '+result);
        var xmlDoc = $.parseXML( result );
        console.log("xmlDoc:"+xmlDoc);
        var xml = $( xmlDoc )
        console.log("xml:"+xml);
        var binToken= xml.find( "wsse\\:BinarySecurityToken" ).text();
        console.log("Binary Token:"+binToken);
                                            alert("Binary Token:"+binToken);

        //  alert(  localStorage.getItem('BinaryToken') );
        wsignin(binToken);
    },
    error:function (jqXHR, textStatus, errorThrown){
        console.log(errorThrown+'error login:' + jqXHR.responseText);
    },
    complete:function(jqXHR, textStatus) {
        console.log('login completed ' + textStatus);
    }
});

我对提琴手的回答如下:

<html><head><title>Working...</title></head><body><form method="POST" name="hiddenform" action="https://login.microsoftonline.com/login.srf"><input type="hidden" name="wa" value="wsignin1.0" /><input type="hidden" name="wresult" value="&lt;t:RequestSecurityTokenResponse xmlns:t=&quot;http://schemas.xmlsoap.org/ws/2005/02/trust&quot;>&lt;t:Lifetime>&lt;wsu:Created xmlns:wsu=&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&quot;>2014-11-28T18:37:25.272Z&lt;/wsu:Created>&lt;wsu:Expires xmlns:wsu=&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&quot;>2014-11-28T19:37:25.272Z&lt;/wsu:Expires>&lt;/t:Lifetime>&lt;wsp:AppliesTo xmlns:wsp=&quot;http://schemas.xmlsoap.org/ws/2004/09/policy&quot;>&lt;wsa:EndpointReference xmlns:wsa=&quot;http://www.w3.org/2005/08/addressing&quot;>&lt;wsa:Address>urn:federation:MicrosoftOnline&lt;/wsa:Address>&lt;/wsa:EndpointReference>&lt;/wsp:AppliesTo>&lt;t:RequestedSecurityToken>&lt;saml:Assertion MajorVersion=&quot;1&quot; MinorVersion=&quot;1&quot; AssertionID=&quot;_7f55172b-43f9-466c-bede-436d794119e2&quot; Issuer=&quot;http://sts.something.com/adfs/services/trust&quot; IssueInstant=&quot;2014-11-28T18:37:25.274Z&quot; xmlns:saml=&quot;urn:oasis:names:tc:SAML:1.0:assertion&quot;>&lt;saml:Conditions NotBefore=&quot;2014-11-28T18:37:25.272Z&quot; NotOnOrAfter=&quot;2014-11-28T19:37:25.272Z&quot;>&lt;saml:AudienceRestrictionCondition>&lt;saml:Audience>urn:federation:MicrosoftOnline&lt;/saml:Audience>&lt;/saml:AudienceRestrictionCondition>&lt;/saml:Conditions>&lt;saml:AttributeStatement>&lt;saml:Subject>&lt;saml:NameIdentifier Format=&quot;urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified&quot;>ddcNR0t/6kWEAp4knvEteA==&lt;/saml:NameIdentifier>&lt;saml:SubjectConfirmation>&lt;saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer&lt;/saml:ConfirmationMethod>&lt;/saml:SubjectConfirmation>&lt;/saml:Subject>&lt;saml:Attribute AttributeName=&quot;UPN&quot; AttributeNamespace=&quot;http://schemas.xmlsoap.org/claims&quot;>&lt;saml:AttributeValue>[email protected]&lt;/saml:AttributeValue>&lt;/saml:Attribute>&lt;saml:Attribute AttributeName=&quot;ImmutableID&quot; AttributeNamespace=&quot;http://schemas.microsoft.com/LiveID/Federation/2008/05&quot;>&lt;saml:AttributeValue>ddcNR0t/6kWEAp4knvEteA==&lt;/saml:AttributeValue>&lt;/saml:Attribute>&lt;/saml:AttributeStatement>&lt;saml:AuthenticationStatement AuthenticationMethod=&quot;urn:oasis:names:tc:SAML:1.0:am:password&quot; AuthenticationInstant=&quot;2014-11-28T18:37:24.943Z&quot;>&lt;saml:Subject>&lt;saml:NameIdentifier Format=&quot;urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified&quot;>ddcNR0t/6kWEAp4knvEteA==&lt;/saml:NameIdentifier>&lt;saml:SubjectConfirmation>&lt;saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer&lt;/saml:ConfirmationMethod>&lt;/saml:SubjectConfirmation>&lt;/saml:Subject>&lt;/saml:AuthenticationStatement>&lt;Signature xmlns=&quot;http://www.w3.org/2000/09/xmldsig#&quot;>&lt;SignedInfo>&lt;CanonicalizationMethod Algorithm=&quot;http://www.w3.org/2001/10/xml-exc-c14n#&quot; />&lt;SignatureMethod Algorithm=&quot;http://www.w3.org/2000/09/xmldsig#rsa-sha1&quot; />&lt;Reference URI=&quot;#_7f55172b-43f9-466c-bede-436d794119e2&quot;>&lt;Transforms>&lt;Transform Algorithm=&quot;http://www.w3.org/2000/09/xmldsig#enveloped-signature&quot; />&lt;Transform Algorithm=&quot;http://www.w3.org/2001/10/xml-exc-c14n#&quot; />&lt;/Transforms>&lt;DigestMethod Algorithm=&quot;http://www.w3.org/2000/09/xmldsig#sha1&quot; />&lt;DigestValue>9Jldbpiqe7ie6Q4R9MBRBL3y3to=&lt;/DigestValue>&lt;/Reference>&lt;/SignedInfo>&lt;SignatureValue>geVzxtwW4bSbLRCEUTgIdn3xwZFnyHXLBamGlnudEwBdxpUrtlyUZBD71zpbP85AIuoFTNPsAGwDsknaRa5jhurDIJ2AsR2rsOh8dlnFDEwCK76zldPVXWIVIat255ShMDRLG3dlBDuHN1h8rdBihKrMD2tfS4xJ8KAI1+jwhaeM8/RYIFktCQUhjnUszmiChOfiqSl+a0aitgboGmP9blDrZcEu8UflslAgnmRr0mRg3NP8JoRqhNH/XuqEXNJUihuGmGqK8pwbSQpPGMl2qmBk20F3lliOFXcToQCFHBMY52c4jix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/KeyInfo>&lt;/Signature>&lt;/saml:Assertion>&lt;/t:RequestedSecurityToken>&lt;t:TokenType>urn:oasis:names:tc:SAML:1.0:assertion&lt;/t:TokenType>&lt;t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue&lt;/t:RequestType>&lt;t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey&lt;/t:KeyType>&lt;/t:RequestSecurityTokenResponse>" /><input type="hidden" name="wctx" value="wa=wsignin1.0&amp;rpsnv=4&amp;ct=1417199483&amp;rver=6.1.6206.0&amp;wp=MBI&amp;wreply=https:%2F%2Fsomethingonline.sharepoint.com%2F_forms%2Fdefault.aspx&amp;lc=1033&amp;id=500046&amp;bk=1417199484&amp;LoginOptions=3" /><noscript><p>Script is disabled. Click Submit to continue.</p><input type="submit" value="Submit" /></noscript></form><script language="javascript">window.setTimeout('document.forms[0].submit()', 0);</script></body></html>

当我在域中时,会收到上述响应,否则,由于已配置智能链接,因此会获得用于自定义登录页面的html。我不确定是否要发布到正确的网址。如何获得回复BinarySecurityToken

金克斯

此问题已解决。我SharePointOnlineCredentials使用提琴手在CSOM中跟踪了请求和响应,并进行了跟踪。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

使用REST进行远程身份验证

来自分类Dev

使用 CLI 与远程 jenkins 进行身份验证

来自分类Dev

使用Sails JS对Jira REST API进行身份验证

来自分类Dev

使用Django REST进行LDAP身份验证

来自分类Dev

在社交媒体网站上使用REST进行身份验证

来自分类Dev

如何使用令牌对REST服务进行身份验证

来自分类Dev

Webapp使用Rest API进行身份验证

来自分类Dev

如何使用 Postman 对 Django REST Framework 进行身份验证

来自分类Dev

使用 spring restTemplate 对 POST REST API 进行身份验证

来自分类Dev

使用 Rest API 进行 Firebase 身份验证

来自分类Dev

使用 REST Http 进行 Akka 身份验证

来自分类Dev

我无法使用 2FA 使用密码对远程主机进行身份验证

来自分类Dev

在Django Rest Framework中使用令牌身份验证进行身份验证时,不会更新last_login字段

来自分类Dev

无法使用WP REST API 2.0插件通过基本身份验证进行身份验证

来自分类Dev

无法使用远程服务器在本地进行身份验证

来自分类Dev

Google远程API允许仅使用经过身份验证的用户进行写操作

来自分类Dev

多用户使用基于ssh密钥的身份验证进行远程访问

来自分类Dev

如何使用密码生成器进行远程登录的身份验证?

来自分类Dev

如何通过代理身份验证进行远程登录?

来自分类Dev

使用 Windows 身份验证的 REST API

来自分类Dev

使用AES进行DESFire身份验证

来自分类Dev

使用Glass进行身份验证

来自分类Dev

使用cURL进行设备身份验证

来自分类Dev

使用JGit的PullCommand进行身份验证

来自分类Dev

使用Play进行身份验证!2.4

来自分类Dev

使用JWT进行身份验证

来自分类Dev

使用Wordpress进行.htaccess身份验证

来自分类Dev

使用gundb进行JWT身份验证

来自分类Dev

使用Firebase进行Shopify身份验证?

Related 相关文章

  1. 1

    使用REST进行远程身份验证

  2. 2

    使用 CLI 与远程 jenkins 进行身份验证

  3. 3

    使用Sails JS对Jira REST API进行身份验证

  4. 4

    使用Django REST进行LDAP身份验证

  5. 5

    在社交媒体网站上使用REST进行身份验证

  6. 6

    如何使用令牌对REST服务进行身份验证

  7. 7

    Webapp使用Rest API进行身份验证

  8. 8

    如何使用 Postman 对 Django REST Framework 进行身份验证

  9. 9

    使用 spring restTemplate 对 POST REST API 进行身份验证

  10. 10

    使用 Rest API 进行 Firebase 身份验证

  11. 11

    使用 REST Http 进行 Akka 身份验证

  12. 12

    我无法使用 2FA 使用密码对远程主机进行身份验证

  13. 13

    在Django Rest Framework中使用令牌身份验证进行身份验证时,不会更新last_login字段

  14. 14

    无法使用WP REST API 2.0插件通过基本身份验证进行身份验证

  15. 15

    无法使用远程服务器在本地进行身份验证

  16. 16

    Google远程API允许仅使用经过身份验证的用户进行写操作

  17. 17

    多用户使用基于ssh密钥的身份验证进行远程访问

  18. 18

    如何使用密码生成器进行远程登录的身份验证?

  19. 19

    如何通过代理身份验证进行远程登录?

  20. 20

    使用 Windows 身份验证的 REST API

  21. 21

    使用AES进行DESFire身份验证

  22. 22

    使用Glass进行身份验证

  23. 23

    使用cURL进行设备身份验证

  24. 24

    使用JGit的PullCommand进行身份验证

  25. 25

    使用Play进行身份验证!2.4

  26. 26

    使用JWT进行身份验证

  27. 27

    使用Wordpress进行.htaccess身份验证

  28. 28

    使用gundb进行JWT身份验证

  29. 29

    使用Firebase进行Shopify身份验证?

热门标签

归档