1. JWT Session
The JWTSession session store works it also a stateless session that uses JSON Web Token standard to decode/encode data.
To use the JWTSession session store you need to add the jooby-jwt
dependency:
Maven
Gradle
<dependency>
<groupId>io.jooby</groupId>
<artifactId>jooby-jwt</artifactId>
<version>3.5.5</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 |