1

Windows Phone アプリケーションで、UAG によって保護されている SharePoint データを読み取ろうとしており、UAG へのセッション Cookie の受け渡しをサポートしたいと考えています。

ホワイト ペーパー、Building Windows Phone 7 applications with SharePoint 2010 Products and Unified Access Gateway (UAG) ( http://technet.microsoft.com/en-us/library/hh180841.aspx ) では、ユーザー資格情報を毎回 UAG に渡す方法を示しています。
しかし、UAG がクライアントに返すセッション Cookie を保存して再利用するにはどうすればよいでしょうか?

    // ホワイト ペーパーの例
    string url = String.Format(“{0}/my/_layouts/activityfeed.aspx?consolidated=true", AppSettings.Url);
    System.Uri authServiceUri = 新しい Uri(url);
    HttpWebRequest クライアント = WebRequest.CreateHttp(authServiceUri) as HttpWebRequest;
    client.Headers["User-Agent"] = "Microsoft Office モバイル";
    client.Headers["認証"] = "基本"
     + Convert.ToBase64String(Encoding.UTF8.GetBytes(AppSettings.Username + ":"
     + AppSettings.Password))+ System.Environment.NewLine;
    // 応答を呼び出して処理します...

このブログ投稿、SharePoint 2010 向け Windows Phone 7 アプリケーションの開発、http://blogs.msdn.com/b/pstubbs/archive/2010/10/04/developing-windows-phone-7-applications-for-sharepoint-2010 .aspxは、FBA で認証し、リクエストで Cookie を渡す方法を示しています。しかし、これが UAG にどの程度当てはまるかはわかりません。

    プライベートボイド認証()
    {
    System.Uri authServiceUri =new Uri("http://phone.contoso.com/_vti_bin/authentication.asmx");

    HttpWebRequest spAuthReq = HttpWebRequest.Create(authServiceUri) as HttpWebRequest;
    spAuthReq.CookieContainer = cookieJar;
    spAuthReq.Headers["SOAPAction"] = "http://schemas.microsoft.com/sharepoint/soap/Login";
    spAuthReq.ContentType = "text/xml; charset=utf-8";
    spAuthReq.Method = "POST";

    // SOAP メッセージをリクエストに追加します
    spAuthReq.BeginGetRequestStream(新しい AsyncCallback(spAuthReqCallBack), spAuthReq);
    }

    // 認証され、Cookie が設定された後
    ListsService.ListsSoapClient のリスト = 新しい ListsService.ListsSoapClient();
    list.CookieContainer = cookieJar;

4

2 に答える 2

1

どちらのアプローチも、状況によってはUAGで機能します。HttpWebRequestを使用する場合は、各呼び出しで基本認証ヘッダーとuseragentヘッダーを設定することにより、UAGに対して認証できます。CookieをUAGに渡す必要はありません。SharePointは、次の応答でデータを返します。

上記のFBAの例を変更して、UAGで機能するようにすることもできます。Authenticateメソッドにuseragentヘッダーと基本認証ヘッダーを追加する必要があります。

spAuthReq.Headers["User-Agent"] = "Microsoft Office Mobile";
spAuthReq.Headers["Authorization"] = "Basic " . . .  

カップルのヒント:

  • HTTPSを使用するため、トランスポートするようにclientconfigセキュリティモードも変更する必要があります。
  • 開発を開始する前に、UAG/SharePoint環境に対してOfficeHubをテストします。
于 2012-09-22T18:17:41.620 に答える
0

UAG は Cookie に署名します。これは、ユーザーがログインするたびに Cookie が難読化されることを意味します。また、UAG は Cookie のサインインを行わず、セッションに使用します。

于 2012-08-24T13:30:35.750 に答える