Packages

implicit class RichResult extends AnyRef

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 java.time.Clock
import play.api.*
import play.api.mvc.*
import pdi.jwt.*

object Application extends Controller {
  implicit val clock: Clock = Clock.systemUTC

  def login = Action { implicit request =>
    Ok.addingToJwtSession(("logged", true))
  }

  def logout = Action { implicit request =>
    Ok.withoutJwtSession
  }
}
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RichResult
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new RichResult(result: Result)(implicit conf: Configuration, clock: Clock)
    Annotations
    @Inject()

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addingToJwtSession[A](key: String, value: A)(implicit arg0: Writes[A], request: RequestHeader): Result

    Keep the current JwtSession and add some values in it, if a key is already defined, it will be overriden.

  5. def addingToJwtSession(values: (String, String)*)(implicit request: RequestHeader): Result

    Keep the current JwtSession and add some values in it, if a key is already defined, it will be overriden.

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  11. def hasJwtHeader(implicit request: RequestHeader): Boolean

    Check if the header for a JwtSession is present (first from the Result then from the RequestHeader)

    Check if the header for a JwtSession is present (first from the Result then from the RequestHeader)

    returns

    a Boolean indicating the presence of a JWT header

  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def jwtSession(implicit request: RequestHeader): JwtSession

    Retrieve the current JwtSession from the headers (first from the Result then from the RequestHeader), if none, create a new one.

    Retrieve the current JwtSession from the headers (first from the Result then from the RequestHeader), if none, create a new one.

    returns

    the JwtSession inside the headers or a new one

  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  18. def refreshJwtSession(implicit request: RequestHeader): Result

    If the Play app has a session.maxAge config, it will extend the expiration of the JwtSession by that time, if not, it will do nothing.

    If the Play app has a session.maxAge config, it will extend the expiration of the JwtSession by that time, if not, it will do nothing.

    returns

    the same Result with, eventually, a prolonged JwtSession

  19. def removingFromJwtSession(keys: String*)(implicit request: RequestHeader): Result

    Remove some keys from the current JwtSession

  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. def withJwtSession(fields: (String, JsValueWrapper)*): Result

    Override the current JwtSession with a new one created from a sequence of tuples

  26. def withJwtSession(session: JsObject): Result

    Override the current JwtSession with a new one created from a JsObject

  27. def withJwtSession(session: JwtSession): Result

    Override the current JwtSession with a new one

  28. def withNewJwtSession: Result

    Override the current JwtSession with a new empty one

  29. def withoutJwtSession: Result

    Remove the current JwtSession, which means removing the associated HTTP header

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped