「受管理卡片」(Managed Card) 是身分識別提供者發行的資訊卡。 它包含:
有關發卡實體的詳細資料:
卡片名稱。
憑證。
STS (安全性權杖服務) 和 MEX (中繼資料交換) 端點。
顯示在卡片上的影像。
與身分識別提供者證實的使用者有關的宣告清單。
詳細說明有關使用者如何驗證身分識別提供者的 STS,以使用必要的宣告值填入資訊卡。 此驗證因數可以是憑證、Kerberos 權杖、自行發出卡片的形式,或在某些情況中是使用者/密碼組合。
注意:為了建立搭配 CardSpace 使用的卡片,身分識別提供者必須產生含有卡片資料的已簽署 XML 檔案。 此資訊卡的名稱有 .CRD 附檔名。
使用此範例工作必須設定網站。 使用範例資料夾提供的安裝批次檔來完成設定:
Setup.bat
如需安裝網站,以及一些疑難排解提示的詳細資訊,請參閱安裝 CardSpace 範例憑證。
編譯卡片寫入器
在 CardWriter 資料夾中 (在 C# 中) 可找到卡片寫入器的原始程式碼。
ManagedCardWriter.cs
在 CardWriter 資料夾中 (在 VB.NET 中) 可找到卡片寫入器的原始程式碼。
ManagedCardWriter.vb
在 Visual Studio 2005 中載入專案檔 (CardWriter.csproj) 並編譯它,或從命令列 (將範例解除封裝所在的位置) 使用 msbuild。
msbuild /nologo /v:quiet CardWriter\CardWriter.csproj
這樣會將卡片寫入器編譯至現在可從命令列執行的 \bin 資料夾中。
bin\cardwriter.exe
Usage:
ManagedCardWriter carddetails.ini [outputfilename.crd]
使用卡片寫入器
卡片寫入器使用 .INI 檔案做為產生 .CRD 檔案的輸入。
bin\cardwriter.exe SampleCards\FabrikamUP.ini
Reading card config from
<install path >\FabrikamUP.ini
Card written to
<install path>\SampleCards\FabrikamUP.crd
注意: |
|---|
輸出卡片放在相同目錄中做為來源 .INI 檔案。 |
瞭解 CardSpace 卡中的資料
在來源 .INI 檔案內有數個區段,這些區段包含可修改的資料以產生供特定用途使用的卡片。
卡片類型的範例
[CARD]
TYPE=UserNamePassword
使用卡片建立器時,每份卡片都可以使用一種驗證類型以驗證身分識別提供者的 STS。 卡片可以是 UserNamePassword、KerberosAuth、SelfIssuedAuth 或 SmartCard 的其中一個類型。
卡片詳細資料範例
[Details]
Name=My Card (U/P backed)
ID=http://www.fabrikam.com/card/unpw/randomnnumber123
version=1
image=images\fabrikam.jpg
在詳細資料區段中有四個必要的欄位。
|
使用者看到的卡片的顯示名稱。 將名稱匯入使用者的身分識別選取器後,使用者可以修改名稱。 |
|
這是卡片的 ID。 匯入有相同 ID 的卡片來提示使用者以新卡片取代舊卡片。 在卡片結構描述的修訂之間應保持 ID 的一致。 |
|
相同卡片的每個新版本應取得遞增的版本號碼。 |
|
使用者在影像匯入身分識別選取器時在卡片上看到影像。 這無法由使用者變更。 |
發行者詳細資料範例
[Issuer]
Address=http://www.fabrikam.com:3074/sts
MexAddress=https://www.fabrikam.com:4074/sts/mex
PrivacyPolicy=http://www.fabrikam.com/PrivacyPolicy.xml
Certificate=LOCALMACHINE/MY/www.fabrikam.com
在發行者區段中有四個必要的欄位。
|
身分識別選取器 STS 的端點 URL。 |
|
STS 的 MEX 端點。 在 CardSpace 中,MEX 端點需要 HTTPS。 |
|
身分識別選取器的隱私權原則位置的 URL。 |
|
憑證位置的公開金鑰用於簽署卡片檔案。 這應該在格式位置/儲存名稱/共用名稱中 (例如 localmachine/My/www.fabrikam.com),或是到包含憑證和私密金鑰之 .PFX 檔案的路徑中。如果 .PFX 檔案受密碼保護,您必須在 .INI 檔案中放入 |
宣告詳細資料範例
[Claims]
1=https://schemas.microsoft.com/ws/2005/05/identity/claims/givenname
2=https://schemas.microsoft.com/ws/2005/05/identity/claims/surname 3=https://schemas.microsoft.com/ws/2005/05/identity/claims/emailaddress
4=https://www.contoso.com/myuritest
在宣告區段中,列出身分識別提供者支援的個別宣告 URI。 使用標準的宣告 URI 組合不需要其他資訊,而使用自訂宣告 URI 需要每個自訂宣告的區段。
自訂宣告 URI 詳細資料範例
[https://www.contoso.com/myuritest]
display=My Super Claim
description=A claim for all to see
每個自訂宣告 URI 必須詳細說明用於每個所建立宣告的顯示名稱和描述。 將這些資料顯示給 CardSpace 身分識別選取器中的使用者。
支援的權杖型別範例
[TokenTypes]
1=urn:oasis:names:tc:SAML:1.0:assertion
2=http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1
身分識別提供者宣告 STS 支援的權杖型別。 這些型別以 URN 列出在權杖型別區段中。 每個 URN 都放在個別的行上,附有做為欄位名稱的索引號碼 (例如 1、2、3 等)。
權杖詳細資料範例
[Token Details]
RequiresAppliesTo=false
身分識別提供者可以決定是否發出權杖給任何信賴憑證者,或可能要求信賴憑證者在要求身分識別時描述自己的身分。
認證
在這個區段中,任何認證提示資訊都可以列出並編碼至卡片中。 不同的驗證類型可能有不同的需求:
對於自行發出的卡片驗證而言,值是來自卡片的 PPID 宣告,提供給使用其憑證的身分識別提供者。
[Credentials] value=eiavryEeugtsZibaD0moDOiIE+106HbYhYIbst73x5A= Hint=Enter your username and password對於使用者名稱/密碼驗證而言,值是針對顯示使用者顯示的使用者名稱 (而且是選擇項)。
[Credentials] value=FrankLee Hint=Enter your username and password對於憑證驗證,您必須使用下列三個方法的其中之一來識別憑證:
憑證的指紋。
參考在其格式位置儲存名稱/一般名稱 (currentUser/My/FrankLee) 的存放區中的憑證
憑證本身的雜湊。
憑證範例
[Credentials]
value=3ce25c9ef8b2d5d99a227e1ea1a28d7f001a3355
Hint=Insert your smartcard now
檢視產生的卡片
.CRD 格式是一種包含之前資訊的文件。 它由身分識別提供者用來以簡明形式表示所有資訊,而且由使用者用來將卡片匯入他們的集合中。
在這個範例中,假設身分識別提供者正在發出認證汽車俱樂部會員資格的卡片,而且該卡片提供使用多個網站的服務或折扣的權限。
簽章
.CRD 檔案的根項目是包裹簽章。
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<Reference URI="#_Object_InfoCard">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>3x/Op7j/BUjCskLqMHNdfCyI/H8=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>
NT...0w==
</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>
MIIG…uEd
</X509Certificate>
<X509Certificate>
MIIE...Q==
</X509Certificate>
</X509Data>
</KeyInfo>
<Object Id="_Object_InfoCard">
...
</Object>
</Signature>
這樣確保在卡片一發出後即免於遭到竄改。 使用簽章可以完成這項作業。 此外,它也提供真正由汽車俱樂部發出的加密確定性,因為它展示了私密金鑰的用法。
兩個 X509Certificate 項目包含身分識別提供者 (汽車俱樂部) 的憑證,以及發行憑證給汽車俱樂部的憑證授權單位的憑證。
簽章後,有一個名為 InformationCard 的項目,這個項目包含卡片的實際中繼資料。 下列範例說明卡片的 XML 項目。
<InformationCard xml:lang="en-us" xmlns="https://schemas.microsoft.com/ws/2005/05/identity">
<InformationCardReference />
<CardName />
<CardImage />
<Issuer />
<IssuerName />
<TimeIssued />
<TimeExpires />
<TokenServiceList />
<SupportedTokenTypeList />
<SupportedClaimTypeList />
<PrivacyNoticeAt />
</InformationCard>
<InformationCardReference> 包含卡片 ID 和版本,可在後續的匯入作業中使用,因此可以更新或覆寫卡片。
<InformationCardReference>
<CardId>
http://www.fabrikam.com/card/unpw/randomnnumber123
</CardId>
<CardVersion>1</CardVersion>
</InformationCardReference>
<CardName> 包含表面的卡片名稱,使用者可以在匯入後修改這個名稱。
<CardName>My Card</CardName>
<CardImage> 包含身分識別提供者可選擇喜好外觀的 Base64 編碼影像。 這在卡片內編碼,而且不可以在 URL 中參考,以確保品牌一致性的提供者無需依賴用戶端解析連結的能力。
<CardImage MimeType="image/jpeg">
</CardImage>
<Issuer> 代表 STS 的 URI,這是每次使用受管理的卡片時所傳送要求安全性權杖 (RST) 訊息的位址。<IssuerName> 是與它關聯的表面名稱。
<Issuer>http://www.fabrikam.com:3074/sts</Issuer>
<TimeIssued> 和 <TimeExpires> 分別包含發出作業的時間和卡片到期日。 到期日應被視為「此中繼資料合約支援至」日期,而不是被視為應在 STS 中處理為帳戶資料的帳戶到期日。
<TimeIssued>2006-08-07T23:37:42.3533826Z</TimeIssued>
<TimeExpires>9999-12-31T23:59:59.9999999Z</TimeExpires>
<TokenServiceList> 包含 <TokenService> 項目的清單,這些項目是用於取得 STS 中繼資料、與其安全連絡和驗證匯入要求的資料。
<TokenServiceList>
<TokenService>
<EndpointReference >
<Address />
<Metadata />
<Identity />
<UserCredential />
</TokenService>
</TokenServiceList>
<EndpointReference> 是 WS-Addressing 端點參考,其中包含 STS 端點。中繼資料區段包含 WS-MetadataExchange 端點的位址。
<EndpointReference xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://www.fabrikam.com:3074/sts</Address>
<Metadata>
<Metadata xmlns="https://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsx="https://schemas.xmlsoap.org/ws/2004/09/mex">
<wsx:MetadataSection >
<wsx:MetadataReference>
<Address xmlns="http://www.w3.org/2005/08/addressing">
https://www.fabrikam.com:4074/sts/mex
</Address>
</wsx:MetadataReference>
</wsx:MetadataSection>
</Metadata>
</Metadata>
<Identity> 包含關聯至 STS 的憑證,通常和在初始簽章中使用的憑證相同。
<Identity xmlns="https://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<X509Data>
<X509Certificate>
MIIGR…uEd
</X509Certificate>
</X509Data>
</KeyInfo>
</Identity>
</EndpointReference>
<UserCredential> 項目的變更視驗證類型而定。
如需個人卡片支援的資訊卡,請使用
<PrivatePersonalIdentifier>項目儲存 PPID。<UserCredential> <SelfIssuedCredential> <PersonalPrivateIdentifier> eiavryEeugtsZibaD0moDOiIE+106HbYhYIbst73x5A= </PersonalPrivateIdentifier> </ SelfIssuedCredential > </UserCredential>關於支援憑證的卡片,由受管理的卡片使用項目
<X509V3Credential>。<KeyIdentifier>項目包含智慧卡憑證的雜湊。<DisplayCredentialHint>項目是使用者在顯示智慧卡之前接收的提示。<UserCredential> <X509V3Credential> <X509Data xmlns="http://www.w3.org/2000/09/xmldsig#"> <KeyIdentifier ValueType="http://docs.oasis-open.org/wss/2004/xx/oasis-2004xx-wss-soap-message-security-1.1#ThumbprintSHA1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 3ce25c9ef8b2d5d99a227e1ea1a28d7f001a3355 </KeyIdentifier> </ X509Data > </X509V3Credential> </UserCredential><UsernamePasswordCredential>保留卡片的預設使用者密稱供支援使用者名稱/密碼的卡片使用。<UserCredential> <DisplayCredentialHint> Enter your username and password </DisplayCredentialHint> <UsernamePasswordCredential> <Username>FrankLee</Username> </UsernamePasswordCredential> </UserCredential>
<SupportedTokenTypeList> 包含 <TokenType> 項目的清單,這些項目詳細說明 STS 支援的權杖型別的清單。
<SupportedTokenTypeList>
<TokenType xmlns="https://schemas.xmlsoap.org/ws/2005/02/trust">
urn:oasis:names:tc:SAML:1.0:assertion
</TokenType>
</SupportedTokenTypeList>
<SupportedClaimTypeList> 包含卡片支援之宣告的清單。 單一宣告由 <SupportedClaimType> 項目描述,其項目是自我說明式項目 (DisplayTag 和 Description)。 範例使用在自行發出集中的提供的預先定義 URI 和自訂的宣告 URI,例如 https://www.contoso.com/myuritest。
<SupportedClaimTypeList>
<SupportedClaimType
uri="https://schemas.microsoft.com/ws/2005/05/identity/claims/givenname">
<DisplayTag>Given Name</DisplayTag>
<Description>Given Name</Description>
</SupportedClaimType>
<SupportedClaimType
Uri="https://schemas.microsoft.com/ws/2005/05/identity/claims/surname">
<DisplayTag>Last Name</DisplayTag>
<Description>Last Name</Description>
</SupportedClaimType>
<SupportedClaimType Uri="https://schemas.microsoft.com/ws/2005/05/identity/claims/emailaddress">
<DisplayTag>Email Address</DisplayTag>
<Description>Email Address</Description>
</SupportedClaimType>
<SupportedClaimType Uri=" https://www.contoso.com/myuritest">
<DisplayTag>My Super Claim</DisplayTag>
<Description>A claim for all to see</Description>
</SupportedClaimType>
</SupportedClaimTypeList>
在 <PrivacyNotice> 項目中找到隱私權原則 URL:
<PrivacyNotice>
http://www.fabrikam.com/PrivacyPolicy.xml
</PrivacyNotice>
字彙
受管理卡片 – 身分識別提供者發行的資訊卡。 資訊卡包含有關安全性權杖伺服器的中繼資料,以及身分識別提供者支援的宣告。
身分識別提供者 – 身分識別提供者發出數位身分識別給使用者,其中包含與使用者有關的資料宣告。
安全性權杖服務 (STS) – 以某個權杖交換另一個權杖的安全性權杖服務。 STS 授予權杖根據使用者驗證伺服器的宣告。 基本上,伺服器將數位身分識別分派給使用者。
請參閱
其他資源
.gif)
Copyright © 2007 by Microsoft Corporation. All rights reserved.