case class JwtSession(headerData: JsObject, claimData: JsObject, signature: String)(implicit conf: Configuration, clock: Clock) extends Product with Serializable
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.
- Alphabetic
- By Inheritance
- JwtSession
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new JwtSession(headerData: JsObject, claimData: JsObject, signature: String)(implicit conf: Configuration, clock: Clock)
- Annotations
- @Inject()
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +[T](key: String, value: T)(implicit writer: Writes[T]): JwtSession
Convert
value
to its JSON counterpart and add it toclaimData
- def +(key: String, value: JsValueWrapper): JwtSession
Add this (key, value) to
claimData
(existing key will be overriden) - def +(value: JsObject): JwtSession
Merge the
value
withclaimData
- def ++(fields: (String, JsValueWrapper)*): JwtSession
Add a sequence of (key, value) to
claimData
- def -(fieldName: String): JwtSession
Remove one key from
claimData
- def --(fieldNames: String*): JwtSession
Remove a sequence of keys from
claimData
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply(fieldName: String): Option[JsValue]
Alias of
get
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def claim: JwtClaim
- val claimData: JsObject
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def get(fieldName: String): Option[JsValue]
Retrieve the value corresponding to
fieldName
fromclaimData
- def getAs[T](fieldName: String)(implicit reader: Reads[T]): Option[T]
After retrieving the value, try to read it as T, if no value or fails, returns None.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def header: JwtHeader
- val headerData: JsObject
- def isEmpty(): Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def refresh(): JwtSession
If your Play app config has a
session.maxAge
, it will extend the expiration by that amount - def serialize: String
Encode the session as a JSON Web Token
- val signature: String
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withClaim(claim: JwtClaim): JwtSession
Overrride the
claimData
- def withHeader(header: JwtHeader): JwtSession
Override the
headerData
- def withSignature(signature: String): JwtSession
Override the
signature
(seriously, you should never need this method)