java.lang.Object
io.jooby.jwt.JwtSessionStore
- All Implemented Interfaces:
SessionStore
A HTTP cookie session store using JSON Web Token. Usage:
{
String key = "256 bit key"
setSessionStore(new JwtSession(key));
}
It uses HMAC-SHA-256 for signing the cookie. Secret key and cookie option can be
specify programmatically or in your application configuration file.
This session store delegates to SessionStore.signed(SessionToken, Function, Function)
using JSON Web Token library.
- Since:
- 2.2.0
- Author:
- edgar
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jooby.SessionStore
SessionStore.InMemory -
Field Summary
Fields inherited from interface io.jooby.SessionStore
DEFAULT_TIMEOUT -
Constructor Summary
ConstructorsConstructorDescriptionJwtSessionStore(String key) Creates a JSON Web Token session store.JwtSessionStore(String key, SessionToken token) Creates a JSON Web Token session store.JwtSessionStore(SecretKey key, SessionToken token) Creates a JSON Web Token session store. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteSession(Context ctx, Session session) findSession(Context ctx) newSession(Context ctx) voidrenewSessionId(Context ctx, Session session) voidsaveSession(Context ctx, Session session) voidtouchSession(Context ctx, Session session)
-
Constructor Details
-
JwtSessionStore
Creates a JSON Web Token session store. It uses a cookie token:SessionToken.SID.- Parameters:
key- Secret key.
-
JwtSessionStore
Creates a JSON Web Token session store. Session token is usually aSessionToken.signedCookie(Cookie),SessionToken.header(String)or combination of both.- Parameters:
key- Secret key.token- Session token.
-
JwtSessionStore
Creates a JSON Web Token session store. Session token is usually aSessionToken.signedCookie(Cookie),SessionToken.header(String)or combination of both.- Parameters:
key- Secret key.token- Session token.
-
-
Method Details
-
newSession
- Specified by:
newSessionin interfaceSessionStore
-
findSession
- Specified by:
findSessionin interfaceSessionStore
-
deleteSession
- Specified by:
deleteSessionin interfaceSessionStore
-
touchSession
- Specified by:
touchSessionin interfaceSessionStore
-
saveSession
- Specified by:
saveSessionin interfaceSessionStore
-
renewSessionId
- Specified by:
renewSessionIdin interfaceSessionStore
-