2024-10-18 008_學寫API_http_schemas_xmlsoap_org-ws-2005-05-identity-claims_是一個標準命名空間
2024-10-18 008_學寫API_http_schemas_xmlsoap_org-ws-2005-05-identity-claims_是一個標準命名空間
http://schemas.xmlsoap.org/ws/2005/05/identity/claims 是一個標準命名空間,用於定義各種用於身份驗證的聲明(Claim)類型。這些聲明可以被身份驗證系統使用來描述某個用戶或實體的屬性。這些標準化的聲明讓不同系統能夠理解和使用這些身份信息。以下是一些常見的聲明(Claims)及其用途:
name(ClaimTypes.Name):- URI:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name - 用於識別用戶的名字。
- URI:
email(ClaimTypes.Email):- URI:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress - 用於表示用戶的電子郵件地址。
- URI:
role(ClaimTypes.Role):- URI:
http://schemas.microsoft.com/ws/2008/06/identity/claims/role - 用於表示用戶的角色,比如 “Admin” 或 “User”。
- URI:
givenname(ClaimTypes.GivenName):- URI:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname - 用於表示用戶的名字(即名部分)。
- URI:
surname(ClaimTypes.Surname):- URI:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname - 用於表示用戶的姓。
- URI:
nameidentifier(ClaimTypes.NameIdentifier):- URI:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier - 用於唯一標識用戶的識別符號(例如,ID 或唯一代碼)。
- URI:
mobilephone(ClaimTypes.MobilePhone):- URI:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/mobilephone - 用於表示用戶的手機號碼。
- URI:
streetaddress(ClaimTypes.StreetAddress):- URI:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/streetaddress - 用於表示用戶的街道地址。
- URI:
country(ClaimTypes.Country):- URI:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country - 用於表示用戶所在的國家。
- URI:
這些都是由標準定義的 URI,對應的 Claim 類型在 .NET 中也有相應的屬性,如 ClaimTypes.Name、ClaimTypes.Email 等。
這些聲明的類型是已經標準化的,用於身份驗證協議,比如 SAML 和 JWT。這樣的標準化意味著不同的身份驗證系統可以輕鬆交換身份信息,而不必擔心互相不兼容。
如果你想使用其他不在標準中的屬性,也可以自己定義 URI 來擴展。例如,你可以自定義一個類似這樣的聲明 URI:http://example.com/claims/employeeid,用於表示某個員工的 ID。這樣,其他人就可以通過這個 URI 知道它代表的意思是“員工 ID”。
所以,這些標準的 Claim URI 提供了一個通用的方式來表示某些常見的身份屬性,而如果需要自定義屬性,也可以自行擴展。