【问题标题】:Why is 'id' called 'sub' in keycloak?为什么'id'在keycloak中被称为'sub'?
【发布时间】:2018-10-28 01:29:13
【问题描述】:

我正在查看新的 Keycloak Beta 4 API。当我获取用户帐户信息时,web 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 keycloak-services


    【解决方案1】:

    根据 keycloak 文档

    Action Token 剖析

    Action 令牌是一个标准的 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)
    

    请参考以下链接https://www.keycloak.org/docs/latest/server_development/index.html#_action_token_anatomy

    原因可能是他们希望保留名称的唯一性。

    【讨论】:

      猜你喜欢
      • 2018-02-02
      • 1970-01-01
      • 2010-10-12
      • 1970-01-01
      • 2018-12-07
      • 1970-01-01
      • 2017-03-28
      • 2014-03-26
      • 1970-01-01
      相关资源
      最近更新 更多