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 } }
- Alphabetic
- By Inheritance
- RichResult
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
RichResult(result: Result)(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
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
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.
-
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.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
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
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
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
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
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
-
def
removingFromJwtSession(keys: String*)(implicit request: RequestHeader): Result
Remove some keys from the current JwtSession
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
withJwtSession(fields: (String, JsValueWrapper)*): Result
Override the current JwtSession with a new one created from a sequence of tuples
-
def
withJwtSession(session: JsObject): Result
Override the current JwtSession with a new one created from a JsObject
-
def
withJwtSession(session: JwtSession): Result
Override the current JwtSession with a new one
-
def
withNewJwtSession: Result
Override the current JwtSession with a new empty one
-
def
withoutJwtSession: Result
Remove the current JwtSession, which means removing the associated HTTP header