简体   繁体   中英

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. ref 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. I am using API manager 1.7.0 version.

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. However, this seems to be applicable for API Manager 1.8.0 and above.

You can find details on how to achieve the same in [2] applicable for API Manager 1.10.0 which the latest released version.

Going through the 1.7.0 documentation I couldn't find such extension points.

[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


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,

  1. You need to write a custom claim retriever implementing ClaimsRetriever interface [3]
  2. Add the full qualified class name of the claim retriever you implemented to api-manager.xml[4] in $APIM_HOME/respository/conf

you can add it to, org.wso2.carbon.apimgt.impl.token.DefaultClaimsRetriever section of the api-manager.xml

The blog [5] explains how to implement the ClaimsRetriever interface with sample code which would be useful to you.

[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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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