简体   繁体   English

WSO2 API管理器:添加JWT属性

[英]WSO2 API manager : Adding JWT properties

In WSO2 API Manager AND ESB integration we can get JWT properties set my API manager from ESB side. 在WSO2 API管理器和ESB集成中,我们可以从ESB端获取设置我的API管理器的JWT属性。 ref http://wso2.com/library/articles/2013/07/use-of-json-web-tokens-in-an-api-fa%C3%A7ade-pattern/ 编号http://wso2.com/library/articles/2013/07/use-of-json-web-tokens-in-an-api-fa%C3%A7ade-pattern/

But I wonder how to set custom JWT properties inside API manager. 但是我不知道如何在API管理器中设置自定义JWT属性。 I am using API manager 1.7.0 version. 我正在使用API​​管理器1.7.0版本。

Thanks 谢谢

Article [1] explains how you can make use of the JWT generator extension point to write your own custom JWT generator logic to include the custom JWT properties. 文章[1]解释了如何利用JWT生成器扩展点来编写自己的定制JWT生成器逻辑,以包括定制JWT属性。 However, this seems to be applicable for API Manager 1.8.0 and above. 但是,这似乎适用于API Manager 1.8.0及更高版本。

You can find details on how to achieve the same in [2] applicable for API Manager 1.10.0 which the latest released version. 您可以在适用于API Manager 1.10.0的最新版本[2]中找到有关如何实现相同功能的详细信息。

Going through the 1.7.0 documentation I couldn't find such extension points. 通过1.7.0文档,我找不到这样的扩展点。

[1] http://wso2.com/library/articles/2014/12/customize-json-web-token-generation-with-wso2-api-manager-1.8.0/ [1] http://wso2.com/library/articles/2014/12/customize-json-web-token-generation-with-wso2-api-manager-1.8.0/

[2] https://docs.wso2.com/display/AM1100/Passing+Enduser+Attributes+to+the+Backend+Using+JWT#PassingEnduserAttributestotheBackendUsingJWT-CustomizetheJWTgeneration [2] https://docs.wso2.com/display/AM1100/Passing+Enduser+Attributes+to+the+Backend+Using+JWT#PassingEnduserAttribute到后端使用JWT-CustomizetheJWTgeneration


Update: For API Manager 1.7.0 you can write a custom claims retriever to achieve what you want, Here's how to do it, 更新:对于API Manager 1.7.0,您可以编写自定义声明检索器以实现所需的功能,这是实现方法,

  1. You need to write a custom claim retriever implementing ClaimsRetriever interface [3] 您需要编写一个实现ClaimsRetriever接口[3]的自定义索赔检索器
  2. Add the full qualified class name of the claim retriever you implemented to api-manager.xml[4] in $APIM_HOME/respository/conf 在$ APIM_HOME / respository / conf中的api-manager.xml [4]中添加您实现的声明检索器的全限定类名称。

you can add it to, org.wso2.carbon.apimgt.impl.token.DefaultClaimsRetriever section of the api-manager.xml 您可以将其添加到api-manager.xml的org.wso2.carbon.apimgt.impl.token.DefaultClaimsRetriever部分中

The blog [5] explains how to implement the ClaimsRetriever interface with sample code which would be useful to you. 博客[5]解释了如何使用示例代码实现ClaimsRetriever接口,这对您很有用。

[3] https://svn.wso2.org/repos/wso2/carbon/platform/trunk/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/token/ClaimsRetriever.java [3] https://svn.wso2.org/repos/wso2/carbon/platform/trunk/components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt /impl/token/ClaimsRetriever.java

[4] https://svn.wso2.com/wso2/custom/projects/projects/carbon/turing/platform/trunk/products/apimgt/1.7.0/config/api-manager.xml [4] https://svn.wso2.com/wso2/custom/projects/projects/carbon/turing/platform/trunk/products/apimgt/1.7.0/config/api-manager.xml

[5] http://sanjeewamalalgoda.blogspot.com/2014/12/how-to-implement-custom-jwt-generator.html [5] http://sanjeewamalalgoda.blogspot.com/2014/12/how-to-implement-custom-jwt-generator.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM