Similar to the default Play Session but using JsObject instead of Map[String, String].
Similar to the default Play Session but using JsObject instead of Map[String, String]. The data is separated into two attributes:
headerData
and claimData
. There is also a optional signature. Most of the time, you should only care about the claimData
which
stores the claim of the token containing the custom values you eventually put in it. That's why all methods of JwtSession
(such as
add and removing values) only modifiy the claimData
.
To see a full list of samples, check the online documentation.
Warning Be aware that if you override the claimData
(using withClaim
for example), you might override some attributes that
were automatically put inside the claim such as the expiration of the token.
By adding import pdi.jwt._
, you will implicitely add this method to RequestHeader
allowing you to easily retrieve
the JwtSession inside your Play application.
By adding import pdi.jwt._
, you will implicitely add this method to RequestHeader
allowing you to easily retrieve
the JwtSession inside your Play application.
package controllers import play.api._ import play.api.mvc._ import pdi.jwt._ object Application extends Controller { def index = Action { request => val session: JwtSession = request.jwtSession } }
By adding import pdi.jwt._
, you will implicitely add all those methods to Result
allowing you to easily manipulate
the JwtSession inside your Play application.
By adding import pdi.jwt._
, you will implicitely add all those methods to Result
allowing you to easily manipulate
the JwtSession inside your Play application.
package controllers import play.api._ import play.api.mvc._ import pdi.jwt._ object Application extends Controller { def login = Action { implicit request => Ok.addingToJwtSession(("logged", true)) } def logout = Action { implicit request => Ok.withoutJwtSession } }