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.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JwtSession
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new JwtSession(headerData: JsObject, claimData: JsObject, signature: String)(implicit conf: Configuration, clock: Clock)
    Annotations
    @Inject()

Value Members

  1. def +[T](key: String, value: T)(implicit writer: Writes[T]): JwtSession

    Convert value to its JSON counterpart and add it to claimData

  2. def +(key: String, value: JsValueWrapper): JwtSession

    Add this (key, value) to claimData (existing key will be overriden)

  3. def +(value: JsObject): JwtSession

    Merge the value with claimData

  4. def ++(fields: (String, JsValueWrapper)*): JwtSession

    Add a sequence of (key, value) to claimData

  5. def -(fieldName: String): JwtSession

    Remove one key from claimData

  6. def --(fieldNames: String*): JwtSession

    Remove a sequence of keys from claimData

  7. def apply(fieldName: String): Option[JsValue]

    Alias of get

  8. def claim: JwtClaim
  9. val claimData: JsObject
  10. def get(fieldName: String): Option[JsValue]

    Retrieve the value corresponding to fieldName from claimData

  11. 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.

  12. def header: JwtHeader
  13. val headerData: JsObject
  14. def isEmpty(): Boolean
  15. def productElementNames: Iterator[String]
    Definition Classes
    Product
  16. def refresh(): JwtSession

    If your Play app config has a session.maxAge, it will extend the expiration by that amount

  17. def serialize: String

    Encode the session as a JSON Web Token

  18. val signature: String
  19. def withClaim(claim: JwtClaim): JwtSession

    Overrride the claimData

  20. def withHeader(header: JwtHeader): JwtSession

    Override the headerData

  21. def withSignature(signature: String): JwtSession

    Override the signature (seriously, you should never need this method)