RichResult
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
}
}
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
Keep the current JwtSession and add some values in it, if a key is already defined, it will be overriden.
Keep the current JwtSession and add some values in it, if a key is already defined, it will be overriden.
Attributes
Keep the current JwtSession and add some values in it, if a key is already defined, it will be overriden.
Keep the current JwtSession and add some values in it, if a key is already defined, it will be overriden.
Attributes
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)
Attributes
- Returns
-
a Boolean indicating the presence of a JWT header
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.
Attributes
- Returns
-
the JwtSession inside the headers or a new one
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.
Attributes
- Returns
-
the same Result with, eventually, a prolonged JwtSession
Remove some keys from the current JwtSession
Override the current JwtSession with a new one
Override the current JwtSession with a new one created from a JsObject
Override the current JwtSession with a new one created from a sequence of tuples
Override the current JwtSession with a new empty one
Remove the current JwtSession, which means removing the associated HTTP header