WCF で構築された API を使用するときに認証が 1 回だけで済むようにするための最善の方法は何ですか?
私の現在のバインディングと動作は以下のとおりです
<bindings>
<wsHttpBinding>
<binding name="wsHttp">
<security mode="TransportWithMessageCredential">
<transport/>
<message clientCredentialType="UserName" negotiateServiceCredential="false" establishSecurityContext="true"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="NorthwindBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceAuthorization principalPermissionMode="UseAspNetRoles"/>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="MembershipProvider"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
次は、クライアント アプリで認証に使用しているものです (現在、WCF を呼び出すたびにこれを行う必要があります)。
Dim client As ProductServiceClient = New ProductServiceClient("wsHttpProductService")
client.ClientCredentials.UserName.UserName = "foo"
client.ClientCredentials.UserName.Password = "bar"
Dim ProductList As List(Of Product) = client.GetProducts()
私がやりたいのは、これらの資格情報を使用して API で認証し、クライアント アプリケーションが Web サービス プロジェクトを使用している間、何らかのタイプのトークンを取得することです。私はこれを私のために確立したと思いましたか?