服务进行身份验证

服务进行身份验证

本文介绍了对 Office 365 SharePoint Online OOTB 服务进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 SharePoint 数据用于非 .Net 平台.为此,我已经使用了诸如 Lists.asmx、Webs.asmx 和 search.asmx 之类的 SharePoint OOTB 服务.我已经使用 Authentication.asmx 成功添加了对基于表单的身份验证的支持.现在,我想在线提供对 Office 365 SharePoint 的支持.为此,我正在开发一个演示 SharePoint Online 网站.问题,我面临的是当我使用 Authentication.asmx 的 Mode 方法时,我得到了Forms"的响应:

I want to consume SharePoint data into a non .Net platform. I already use the SharePoint OOTB services like Lists.asmx, Webs.asmx and search.asmx for this purpose.I have successfully added support for forms based authentication using Authentication.asmx.Now, I want to provide support for Office 365 SharePoint online. For that purpose I have a demo SharePoint Online site that I am working on.Problem, I am facing is when I use Mode method of Authentication.asmx I get ‘Forms’ in response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
    <ModeResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
        <ModeResult>Forms</ModeResult>
    </ModeResponse>
</soap:Body>
</soap:Envelope>

但是,当我使用 Login.asmx 并传递正确的用户名和密码时,出现PasswordNotMatch"错误,相同的凭据在浏览器中运行良好.

However when I use Login.asmx and pass correct username and password, I get ‘PasswordNotMatch’ error, the same credentials are working fine in browser.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
    <LoginResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
        <LoginResult>
         <ErrorCode>PasswordNotMatch</ErrorCode>
            <TimeoutSeconds>0</TimeoutSeconds>
        </LoginResult>
    </LoginResponse>
</soap:Body>
</soap:Envelope>

注意:- 这非常适用于 FBA 非 Office 365 SharePoint 网站.

Note:- This works perfect for a FBA non Office 365 SharePoint site.

有人可以帮助我实现对 Office 365 SharePoint Online OOTB 服务的支持吗?

Could somebody please help me in implementing the support for Office 365 SharePoint Online OOTB services?

推荐答案

我一直在研究类似的想法并且 这个帖子 非常有帮助.他们实际上有一个使用 PInvoke 的网络服务示例,它可能会帮助您实现目标.

I've been looking into a similar idea and this thread has been extremely helpful. They actually have a webservice sample using the PInvoke, it might help you get there.

我的搜索使我Wictor Wilen 的另一篇博文,但暂时避免使用 ClientOM.

my search led me to this other post by Wictor Wilen, but trying to avoid the ClientOM for now.

Edit2: 好的,开始工作了.使用上面 Wictor 的代码,我下载了他的示例解决方案,并将MsOnlineClaimsHelper.cs"和WcfClientContracts.cs"移到我的项目中,稍后我将摆弄这些文件中真正使用的内容.我只更改了它们以删除 ClientOM 引用,包括 clientContext_ExecutingWebRequest 方法.

alright, got this working. Using the code from Wictor above, I downloaded his sample solution and moved "MsOnlineClaimsHelper.cs" and "WcfClientContracts.cs" to my project, I will be fiddling with what is really used from these files later. I only changed them to remove the ClientOM references including the clientContext_ExecutingWebRequest method.

在示例 MVC3 应用程序或控制台应用程序中:

In a sample MVC3 app or Console app:

MsOnlineClaimsHelper claimsHelper = new MsOnlineClaimsHelper("https://my365site.sharepoint.com/sites/enterprise/", "[email protected]", "secret");

using (var lists = new SharePointLists.Lists())
{
    lists.Url = @"https://my365site.sharepoint.com/sites/enterprise/_vti_bin/lists.asmx";
    lists.CookieContainer = claimsHelper.CookieContainer;
    var listCol = lists.GetListCollection();
    ViewBag.Message = listCol.InnerXml;
    //Console.Write(listCol.InnerXml);
}

这篇关于对 Office 365 SharePoint Online OOTB 服务进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 18:40