为什么 'id' 在 keycloak 中被称为 'sub'?
Why is 'id' called 'sub' in keycloak?
我正在查看新的 Keycloak Beta 4 API。当我获取用户帐户信息时,在网络 ui 中称为 'id' 的内容在帐户对象中返回为 'sub'。
{ sub: '25a37fd0-d10e-40ca-af6c-821f20e01be8',
name: 'Barrack Obama',
preferred_username: 'obama@whitehouse.gov',
given_name: 'Barrack',
family_name: 'Obama',
email: 'obama@whitehouse.gov' }
什么是 'sub',这是一个安全的 uuid 来映射数据库对象吗?
根据 keycloak 文档
动作令牌剖析
操作令牌是一个标准的 Json Web 令牌,使用活动领域密钥签名,其中有效负载包含几个字段:
typ - Identification of the action (e.g. verify-email)
iat and exp - Times of token validity
sub - ID of the user
azp - Client name
iss - Issuer - URL of the issuing realm
aud - Audience - list containing URL of the issuing realm
asid - ID of the authentication session (optional)
nonce - Random nonce to guarantee uniqueness of use if the operation can only be executed once (optional)
请参考以下内容linkhttps://www.keycloak.org/docs/latest/server_development/index.html#_action_token_anatomy
原因可能是他们想保留名称的唯一性。
我正在查看新的 Keycloak Beta 4 API。当我获取用户帐户信息时,在网络 ui 中称为 'id' 的内容在帐户对象中返回为 'sub'。
{ sub: '25a37fd0-d10e-40ca-af6c-821f20e01be8',
name: 'Barrack Obama',
preferred_username: 'obama@whitehouse.gov',
given_name: 'Barrack',
family_name: 'Obama',
email: 'obama@whitehouse.gov' }
什么是 'sub',这是一个安全的 uuid 来映射数据库对象吗?
根据 keycloak 文档
动作令牌剖析
操作令牌是一个标准的 Json Web 令牌,使用活动领域密钥签名,其中有效负载包含几个字段:
typ - Identification of the action (e.g. verify-email)
iat and exp - Times of token validity
sub - ID of the user
azp - Client name
iss - Issuer - URL of the issuing realm
aud - Audience - list containing URL of the issuing realm
asid - ID of the authentication session (optional)
nonce - Random nonce to guarantee uniqueness of use if the operation can only be executed once (optional)
请参考以下内容linkhttps://www.keycloak.org/docs/latest/server_development/index.html#_action_token_anatomy
原因可能是他们想保留名称的唯一性。