共用方式為


<add><knownCertificates>

將 X.509 證書加入已知憑證集合中。

<configuration>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceCredentials>
            <issuedTokenAuthentication>
              <knownCertificates>
                <add>

語法

<knownCertificates>
   <add findValue="String"
      storeLocation="CurrentUser/LocalMachine"
      storeName="AddressBook/AuthRoot/CertificateAuthority/Disallowed/My/Root/TrustedPeople/TrustedPublisher"
      x509FindType="FindByThumbprint/FindBySubjectName/FindBySubjectDistinguishedName/FindByIssuerName/FindByIssuerDistinguishedName/FindBySerialNumber/FindByTimeValid/FindByTimeNotYetValid/FindBySerialNumber/FindByTimeExpired/FindByTemplateName/FindByApplicationPolicy/FindByCertificatePolicy/FindByExtension/FindByKeyUsage/FindBySubjectKeyIdentifier"/>
</knownCertificates>

屬性和項目

下列章節說明屬性、子元素和父元素。

Attributes

Attribute Description
尋找值 String. 要搜尋的值。
商店位置 列舉。 這是兩個要搜尋的店面之一。
storeName 列舉。 其中一個系統儲存區要搜尋。
x509尋找類型 列舉。 要搜尋的憑證欄位之一。

findValue 屬性

價值觀 Description
繩子 此值取決於所搜尋的欄位 (由 X509FindType 屬性指定)。 例如,如果搜尋指紋,則值必須是十六進位數的字串。

x509FindType 屬性

價值觀 Description
枚舉 值包括:FindByThumbprint、FindBySubjectName、FindBySubjectDistinguishedName、FindByIssuerName、FindByIssuerDistinguishedName、FindBySerialNumber、FindByTimeValid、FindByTimeNotYetValid、FindBySerialNumber、FindByTimeExpired、FindByTemplateName、FindByApplicationPolicy、FindByCertificatePolicy、FindByExtension、FindByKeyUsage、FindBySubjectKeyIdentifier。

storeLocation 屬性

價值觀 Description
枚舉 CurrentUser 或 LocalMachine。

storeName 屬性

價值觀 Description
枚舉 值包括:AddressBook、AuthRoot、CertificateAuthority、Disallowed、My、Root、TrustedPeople 和 TrustedPublisher。

子專案

沒有。

父項目

元素 Description
<已知憑證> 代表由安全令牌服務(STS)提供的 X.509 憑證集合,用於驗證安全令牌。

備註

發行之權杖的情況有三個階段。 在第一階段,嘗試存取服務的客戶端會被指向 安全令牌服務。 安全令牌服務接著對客戶端進行認證,並隨後發出一個令牌,通常是安全斷言標記語言(SAML)令牌。 用戶端接著會以權杖傳回服務。 此服務會檢查資料的權杖,使服務能夠驗證權杖,因此也能夠驗證用戶端。 為了驗證該憑證,安全憑證服務所使用的憑證必須為服務所知。

<issuedTokenAuthentication> 元素是任何此類安全性權杖服務憑證的存放庫。 若要新增憑證,請使用 <knownCertificates>。 為每個憑證插入 <一個新增> 元素 <knownCertificates> 元素 ,如下範例所示。

<issuedTokenAuthentication>
  <knownCertificates>
    <add findValue="www.contoso.com"
         storeLocation="LocalMachine"
         storeName="My"
         X509FindType="FindBySubjectName" />
  </knownCertificates>
</issuedTokenAuthentication>

根據預設,必須從安全權杖服務取得憑證。 這些「已知的」憑證可確保只有合法的用戶端可以存取服務。

欲檢視客戶端必須由聯邦服務認證的條件,以及更多使用此配置元素的資訊,請參閱 如何:在聯邦服務上配置憑證。 如需同盟案例的詳細資訊,請參閱同盟和發行的權杖

Example

以下範例為任何 STS 憑證新增憑證到資料庫。

<serviceBehaviors>
  <behavior name="myServiceBehavior">
    <serviceCredentials>
      <issuedTokenAuthentication>
        <knownCertificates>
          <add findValue="www.contoso.com"
               storeLocation="LocalMachine"
               storeName="CertificateAuthority"
               x509FindType="FindByIssuerName" />
        </knownCertificates>
      </issuedTokenAuthentication>
    </serviceCredentials>
  </behavior>
</serviceBehaviors>

另請參閱