类型声明http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier
应该用于什么?
这是主要问题,这里还有其他问题。
它与http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name
索赔有何不同?
与名称声明相反,它对于特定用户是永久性的吗?
它是全球范围的还是 IdP 范围的?
类型声明http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier
应该用于什么?
这是主要问题,这里还有其他问题。
它与http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name
索赔有何不同?
与名称声明相反,它对于特定用户是永久性的吗?
它是全球范围的还是 IdP 范围的?
Name
,只是一个名字。如果我们在谈论人,请想想“埃里克”;服务器“file01”。
ANameIdentifier
是对象的 ID。回到我们的 person 对象,Eric 的 UserID 在您的数据库中可能是 435。对于服务器,标识符可以是 FQDN 或 SID 之类的东西。
根据这篇文章NameID
,显然名称标识符是 SAML 1.1 属性,并在 SAML 2.0中被取代。
我想解决@Jason 的评论和@nzpcmad 的帖子。我不认为独特性是一个明确的要求。该问题标记为adfs2.0,但引用的架构归 OASIS 所有。所以这些是我们需要平衡的两方解释。
微软对 ADFS 的立场显然是有一个独特的要求。我们在“声明的作用”一文中看到了这一点。毫无疑问,ADFS 投下了很大的阴影,但这似乎是一个实现细节。
但是,查看SAML 1.1 规范,我看不到这样的断言。我们在规范的第 2.4.2.2 节中得到的最接近的是:
该元素通过名称限定符、名称和格式的组合指定主题。该元素具有以下属性:
...
NameQualifier[可选] 限定主题名称的安全或管理域。此属性提供了一种方法来联合来自不同用户存储的名称而不会发生冲突。
规范的文本告诉我,我需要能够使用这三个属性的组合来找到一个人,但它没有断言唯一性。我不能有两个指向同一个用户的条目吗?似乎是这样。此外,规范是否表明在不足以唯一标识名称NameQualifier
的情况下需要该属性?NameIdentifier
那么这一切会导致什么?
Per The Role of Claims,
Name The unique name of the user
Name Identifier The SAML name identifier of the user
These two claims are part of the group of claims that AD FS 2.0 configures by default.
This implies that they are IP scoped.
e.g. when you log in to Google using ACS, "nameidentifier" is the unique GUID associated with your account by Google whereas name is your Google login e.g. "tim.smith@gmail.com".
ClaimTypes.Name
用于用户名并将用户的身份ClaimTypes.NameIdentifier
指定为对象透视图。如果您将它们添加到一种对象中,该对象为您提供访问方法(例如在 dotnet 世界中),它们是和.ClaimIdentity
User.Identity
GetUserName()
GetUserId()
该nameidentifier
声明应用于获取唯一的用户名。
对于 Windows 身份验证:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier domain\warlock
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name 0#.w|domain\warlock
domain\warlock 是 Windows 登录名
对于基于声明的身份验证:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier warlock@localhost.com
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name 05.t|myidentityprovider|warlock@localhost.com
电子邮件被指定为标识符声明
如您所见.../identity/claims/name
,它还描述了名称和身份提供者。