Categories
Development

Postman JWT token generator

Use script below to generate and set JWT token with HS256 signature and store it in “jwt” environment variable. To use it edit SECRET_KEY and set headers as you need. Then paste the script into pre-request script in postman HTTP request definition. Use the environment variable {{jwt}} in your authentication of type Bearer to use it.

You can check the result token in https://token.dev/. And you can read all about JWT and their signing at https://auth0.com/blog/rs256-vs-hs256-whats-the-difference/ .

Code taken/was derived from  https://hirosht.medium.com/customized-jwt-encoded-with-hmac-sha256-hs256-267574bd7639 

Categories
Development

Graal basics

I spent last year designing and implementing javascript scripting support in our Java/Spring backend with the help of GraalVM and its polyglot support. I fell in love with Graal, as it brings quite a lot of features and performance improvements to Java JVM. Will focus on basics of Graal Polyglot capabilities in this article.

I’m not going to write about what is Graal, others have done this better:

https://www.graalvm.org/why-graalvm/
https://www.graalvm.org/reference-manual/embed-languages/

Nice article to read is also Top 10 Things To Do With GraalVM.

Make sure you follow their twitter and blog:
https://twitter.com/graalvm
https://medium.com/graalvm

And its a good idea to join public Graal slack group as the devs and community is quite active and eager to respond.

https://join.slack.com/t/graalvm/shared_invite/zt-anuczas6-PrCle0QVfUFPrnMEcp_JEw

From my experience you will need to ask for some advanced/hidden features as they are not described in docs or scattered between several sources. Advanced topics are described here:

https://github.com/oracle/graaljs/tree/master/docs/user

One of the killer features of Graal is its polyglot support. The most mature one is the Javascript scripting engine. And as opposed to previous javascript java implementation, its fully ECMAScript compliant so you have the whole JS library ecosystem at your disposal.