Hi Sanjeewa On Wed, May 18, 2016 at 6:37 PM, Sanjeewa Malalgoda <[email protected]> wrote:
> As of now we have interface to generate JWT. So we can implement specific > class with this implementation. > And with this feature lets do not remove flexibility of extending JWT > generation logic. > We aren't going to remove the flexibility of extending JWT generation logic, we will use the library to generate the token in our default AbstractJWTGenerator class. > > Thanks, > sanjeewa. > > On Wed, May 18, 2016 at 3:54 PM, Abimaran Kugathasan <[email protected]> > wrote: > >> Hi All, >> >> >> Shall we use Nimbus libraryto generate JWT in API Manager? >> >> Currently, we are generating the token without any standard libraries >> which leads to errors like [2] and [3]. >> >> For the JIRA [3], currently we are having following code snippet to >> create x5t header. >> >> byte[] digestInBytes = digestValue.digest(); >> String publicCertThumbprint = hexify(digestInBytes); >> String base64EncodedThumbPrint = Base64Utils.encode( >> publicCertThumbprint.getBytes()); >> >> But, We have to use in the following way inorder to fix by ourself >> >> byte[] digestInBytes = digestValue.digest(); >> String base64EncodedThumbPrint; >> base64EncodedThumbPrint = Base64Utils.encode(digestInBytes); >> base64EncodedThumbPrint = base64EncodedThumbPrint.split("=")[0]; // >> Remove any trailing '='s >> base64EncodedThumbPrint = base64EncodedThumbPrint.replace('+', '-'); // >> 62nd char of encoding >> base64EncodedThumbPrint = base64EncodedThumbPrint.replace('/', '_'); // >> 63rd char of encoding >> return base64EncodedThumbPrint; >> >> If we are using Nimbus, we can use JWSHeader.Builder [4] to generate JWT >> Headers like >> >> JWSHeader header = new JWSHeader.Builder(JWSAlgorithm.HS256). >> contentType("text/plain"). >> customParam("exp", new Date().getTime()). >> build(); >> >> We can add custom headers too. Appriciate your input on this. >> >> [1] : http://connect2id.com/products/nimbus-jose-jwt >> [2] : https://wso2.org/jira/browse/APIMANAGER-4117 >> [3] : https://wso2.org/jira/browse/APIMANAGER-2922 >> [4] : >> http://static.javadoc.io/com.nimbusds/nimbus-jose-jwt/4.5/com/nimbusds/jose/JWSHeader.Builder.html >> >> -- >> Thanks >> Abimaran Kugathasan >> >> Software Engineer | WSO2 Inc >> Data & APIs Technologies Team >> Mobile : +94 773922820 >> >> <http://stackoverflow.com/users/515034> >> <http://lk.linkedin.com/in/abimaran> >> <http://www.lkabimaran.blogspot.com/> <https://github.com/abimarank> >> <https://twitter.com/abimaran> >> >> > > > -- > > *Sanjeewa Malalgoda* > WSO2 Inc. > Mobile : +94713068779 > > <http://sanjeewamalalgoda.blogspot.com/>blog > :http://sanjeewamalalgoda.blogspot.com/ > <http://sanjeewamalalgoda.blogspot.com/> > > > -- Thanks Abimaran Kugathasan Software Engineer | WSO2 Inc Data & APIs Technologies Team Mobile : +94 773922820 <http://stackoverflow.com/users/515034> <http://lk.linkedin.com/in/abimaran> <http://www.lkabimaran.blogspot.com/> <https://github.com/abimarank> <https://twitter.com/abimaran>
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
