4

VS 2010 から VS 2012 への移行の一環として、開発段階で Identity and Access Tools の LocalSTS を STS として使用し始めました。セットアップは非常に簡単ですが、1 つの問題が発生します。これは、生成されたトークンにクレーム タイプごとに複数のクレーム値を含めるように構成することです。一般的な構成は次のようになります。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="localSTSConfiguration" type="System.IdentityModel.Tools.LocalSTS.LocalSTSConfiguration, LocalSTS, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <localSTSConfiguration port="13248" signingCertificate="LocalSTS.pfx" signingCertificatePassword="LocalSTS" issuerName="LocalSTS" tokenFormat="Saml11">
    <claims>
      <add type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" displayName="Name" value="Terry" />
      <add type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" displayName="Surname" value="Adams" />
      <add type="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" displayName="Role" value="Member" />
      <add type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" displayName="Email" value="terry@contoso.com" />
      <add type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier" displayName="Name Identifier" value="terry@contoso.com" />
    </claims>
  </localSTSConfiguration>
</configuration>

上記は問題なく動作しますが、ユーザーをメンバー ロールと管理者ロールの両方のメンバーにしたい場合、どのように表現すればよいでしょうか。次のことを試しましたが、特定のクレーム タイプに対して指定された最後のクレーム値のみが含まれています。したがって、以下の構成では、ユーザーはメンバー ロールではなく、管理者ロールのメンバーのみになります。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    ...
  </configSections>
  <startup>
    ...
  </startup>
  <localSTSConfiguration port="13248" signingCertificate="LocalSTS.pfx" signingCertificatePassword="LocalSTS" issuerName="LocalSTS" tokenFormat="Saml11">
    <claims>
      ...
      <add type="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" displayName="Role" value="Member" />
      <add type="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" displayName="Role" value="Administrator" />
      ...
    </claims>
  </localSTSConfiguration>
</configuration>
4

1 に答える 1

1

LocalSTS dll バージョン 4 (Identity and Access Tool 1.01 に含まれる) までは、複数のクレーム値は可能ではないようですが、LocalSTS dll バージョン 5 (Identity and Access Tool 1.02 に含まれる) ではこの機能が追加されました。ツールのバージョン 1.02 は 10 月 23 日にリリースされまし

于 2012-10-25T11:08:05.500 に答える