WSO2-IS 如何从 JWT 令牌中检索租户域? [英] WSO2-IS how to retrieve tenant domain from JWT token?
问题描述
我需要一种将租户域信息放入 JWT 令牌的方法(如声明)?
I need a way to put tenant domain info in JWT token (like a claim)?
我必须在我的 Java 应用程序中检索它
I've to retrieve it in my java application
推荐答案
相信你在谈论 OpenID connect
规范的 ID Token
.
Believe you are talking about the ID Token
of the OpenID connect
spec.
更简单的方法是勾选服务提供商应用程序的本地和出站配置
部分的在本地主题标识符中使用租户域
选项.这将在 ID 令牌的 sub
字段中的用户名末尾附加租户域,如下所示.(您的 Java 应用程序可以处理提取租户域)"sub": "admin@carbon.super"
Easier way to achieve this is to tick the Use tenant domain in local subject identifier
option of your Service Provider application's Local and outbound configurations
section. This will append the tenant domain at the end of the username in the sub
field of the ID token as below. (Your Java application can process that extract the tenant domain)
"sub": "admin@carbon.super"
如果您不喜欢这种方法,您可能需要编写一个自定义 ID 令牌构建器来扩展 默认.在 identity.xml 文件中定义为
If you don't like that approach, you might want to write a custom ID token builder extending the default. Defined in the identity.xml file as <IDTokenBuilder>org.wso2.carbon.identity.openidconnect.DefaultIDTokenBuilder</IDTokenBuilder>
这篇关于WSO2-IS 如何从 JWT 令牌中检索租户域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!