Jooby

JWT Session

The JwtSessionStore session store works it also a stateless session that uses JSON Web Token standard to decode/encode data.

To use the JwtSessionStore session store you need to add the jooby-jwt dependency:

Maven
Gradle
<dependency>
  <groupId>io.jooby</groupId>
  <artifactId>jooby-jwt</artifactId>
  <version>4.1.0</version>
</dependency>
JWT Session
Java
Kotlin
import io.jooby.session.JwtSessionStore;

{
  String secret = "super secret key";           // (1)

  setSessionStore(new JwtSessionStore(secret)); // (2)

  get("/", ctx -> {
    Session session = ctx.session();

    session.put("foo", "bar");

    return session.get("foo").value();
  });
}
  1. Set a secret key

  2. Use JwtSessionStore