我正试图使用超级管理员(superadmin(模拟用户(tony123(。我所遵循的步骤如下。
- 获取superadmin的访问令牌,如下所示
curl --location --request POST 'http://localhost:8180/auth/realms/tenant/protocol/openid-connect/token'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'grant_type=password'
--data-urlencode 'username=superadmin'
--data-urlencode 'password=<superadmin-password>'
--data-urlencode 'client_id=<source-client-id>'
--data-urlencode 'client_secret=<source-client-secret>'
- 使用上述令牌,我将获得模拟用户的(tony123(令牌,如下所示
curl --location --request POST 'http://localhost:8180/auth/realms/tenant/protocol/openid-connect/token'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'client_id=<source-client-id>'
--data-urlencode 'client_secret=<source-client-secret>'
--data-urlencode 'grant_type=urn:ietf:params:oauth:grant-type:token-exchange'
--data-urlencode 'subject_token=<access token got in step one>'
--data-urlencode 'requested_token_type=urn:ietf:params:oauth:token-type:access_token'
--data-urlencode 'requested_subject=<user id of tony123>'
通过以上两个步骤,我可以获得正确的模拟令牌。此模拟令牌仅包含令牌中tony123的preferred_username
和email
属性。我想通过从用户属性映射中添加一些phone_number
来进一步自定义模拟令牌。我不能这么做。
我尝试在Key斗篷管理中的source-client
中添加phone_number
的映射程序。这是一次失败的尝试。如何做到这一点?
首先创建自定义属性,然后在客户端映射器中添加用户属性类型的令牌映射器。
看看这一页。