是否可以修改 WSO2 令牌响应? [英] Is it possible to modify WSO2 token response?

查看:71
本文介绍了是否可以修改 WSO2 令牌响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们现在使用 WSO2 生成令牌我喜欢向该响应有效负载添加自定义参数

we using WSO2 to generate token now I like to add custom parameters to that response payload

当前回复:

{"access_token":"6a841cf7-fad1-3f1d-8e9a-d0f692beedd3","scope":"am_application_scope default","token_type":"Bearer","expires_in":2203}

我喜欢修改:

{"access_token":"6a841cf7-fad1-3f1d-8e9a-d0f692beedd3","scope":"am_application_scope default","token_type":"Bearer","expires_in":2203,"app_name":"ABC"}

如何在响应中添加新属性app_name":ABC"?

how can i add new attribute "app_name":"ABC" in response ?

有可能吗?

推荐答案

你可以这样做.实现类在/repository/conf/identity/identity.xml中是这样配置的.

You can do that. The implementation class is configured like this in <APIM_HOME>/repository/conf/identity/identity.xml.

    <SupportedResponseTypes>
        <SupportedResponseType>
            <ResponseTypeName>token</ResponseTypeName>
            <ResponseTypeHandlerImplClass>org.wso2.carbon.identity.oauth2.authz.handlers.TokenResponseTypeHandler</ResponseTypeHandlerImplClass>
        </SupportedResponseType>

在这里,您可以拥有自己的实现.您可以使用您的类(仅)构建一个 jar 并将其放入 /repository/components/lib/

Here, you can have your own implementation. You can build a jar with your class (only) and put it inside <APIM_HOME>/repository/components/lib/

目前的实现可以在这里.

这篇关于是否可以修改 WSO2 令牌响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆