2

フォーム認証は機能しません。SMFが特定のユーザーロールを必要とするサーバー上の*.ism/ Manifestファイルにアクセスしようとした場合、認証Cookieはサーバーに送信されません。

私が行うこと:1。RIAWCFをサポートする新しいSilverlightSmoothStreamingテンプレートを作成します。2.web.configを構成します。

<connectionStrings>
<add name="ApplicationServices" connectionString="Data Source=[SERVER];Initial Catalog=[CATALOG];User ID=[USER];Pwd=[PASSWORD];" providerName="System.Data.SqlClient" />

<system.web>
      <authentication mode="Forms">
        <forms loginUrl="~/Account/LogOn" timeout="2880" />
      </authentication>
      <membership>
        <providers>
          <clear />
          <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
        </providers>
      </membership>
      <profile>
        <providers>
          <clear />
          <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
        </providers>
        <properties>
          <add name="Gender" />
          <add name="Birthday" />
          <add name="AvatarPath" />
        </properties>
      </profile>
      <roleManager enabled="true">
        <providers>
          <clear />
          <add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
            <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" /> 
        </providers>
      </roleManager>
  1. 認証サービスを追加し、ユーザークラスを修正します(3つの小道具を追加します)。
  2. クライアント側で、これをapp.xaml.csに追加します。
     public App()
     {
     //Default things...
     InitializeWebContext();
     }

    private void InitializeWebContext()
    {
        WebContext webContext = new WebContext();
        var fa = new FormsAuthentication();
        var ac = new AuthenticationDomainService1();
        fa.DomainContext = ac;
        fa.Login(new LoginParameters("user", "password"), (y) =>
                                                                    {
                                                                        if (!y.HasError)
                                                                        {
                                                                            this.RootVisual = new MainPage();
                                                                        } 
                                                                    }, null);
        webContext.Authentication = fa;
        ApplicationLifetimeObjects.Add(webContext);
        Resources.Add("WebContext", WebContext.Current);
    }

アクセスは、ターゲットディレクトリのweb.configファイルによって制限されています。

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.web>
            <authorization>
            <allow roles="Role_name" />     
            <deny users="*" />                                      
            </authorization>
        </system.web>
    </configuration>

ユーザーはこのロールに存在します。

Xaml(Big Bunny)で指定されているデフォルトのビデオを使用すると、すべて問題ありません。しかし、mediasourceをサーバー上の制限付きゾーンへのパスに変更すると、アクセスエラーが発生します。クライアント側では、ユーザー資格情報を正常に取得します。

Fiddlerは次のことを示しています。RIAWCFで別の制限されたメソッド([RequiresAuthentication])にアクセスしようとすると、クライアントはAuth Cookieを送信しますが、SMFPlayerがメディアソースにアクセスしようとすると、そのCookieは送信されませんでした。

私は何を逃しましたか?

4

1 に答える 1

0

いくつかの回避策を見つけました: ストリーム ファイルをサブディレクトリに転送し、そのサブディレクトリへのアクセスを制限する場合 ("ism" ファイルを含むディレクトリではなく)。マニフェストは匿名ユーザーに発行されますが、データ ストリームは登録済みのみです (プレーヤーがタッチ データ ストリームを試行すると、認証 Cookie が正常に添付されます)。

于 2012-01-08T19:52:07.990 に答える