play.silhouette.impl.authenticators
JWTAuthenticatorService
Companion object JWTAuthenticatorService
class JWTAuthenticatorService extends AuthenticatorService[JWTAuthenticator] with api.Logger
The service that handles the JWT authenticator.
If the authenticator DAO is deactivated then a stateless approach will be used. But note that you will loose the possibility to invalidate a JWT.
- Alphabetic
- By Inheritance
- JWTAuthenticatorService
- Logger
- AuthenticatorService
- ExecutionContextProvider
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new JWTAuthenticatorService(settings: JWTAuthenticatorSettings, repository: Option[AuthenticatorRepository[JWTAuthenticator]], authenticatorEncoder: AuthenticatorEncoder, idGenerator: IDGenerator, clock: Clock)(implicit executionContext: ExecutionContext)
- settings
The authenticator settings.
- repository
The repository to persist the authenticator. Set it to None to use a stateless approach.
- authenticatorEncoder
The authenticator encoder.
- idGenerator
The ID generator used to create the authenticator ID.
- clock
The clock implementation.
- executionContext
The execution context to handle the asynchronous operations.
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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def create(loginInfo: LoginInfo)(implicit request: RequestHeader): Future[JWTAuthenticator]
Creates a new authenticator for the specified login info.
Creates a new authenticator for the specified login info.
- loginInfo
The login info for which the authenticator should be created.
- request
The request header.
- returns
An authenticator.
- Definition Classes
- JWTAuthenticatorService → AuthenticatorService
- def discard(authenticator: JWTAuthenticator, result: Result)(implicit request: RequestHeader): Future[AuthenticatorResult]
Removes the authenticator from backing store.
Removes the authenticator from backing store.
- authenticator
The authenticator instance.
- result
The result to manipulate.
- request
The request header.
- returns
The manipulated result.
- Definition Classes
- JWTAuthenticatorService → AuthenticatorService
- def embed(token: String, request: RequestHeader): RequestHeader
Adds a header with the token as value to the request.
Adds a header with the token as value to the request.
- token
The token to embed.
- request
The request header.
- returns
The manipulated request header.
- Definition Classes
- JWTAuthenticatorService → AuthenticatorService
- def embed(token: String, result: Result)(implicit request: RequestHeader): Future[AuthenticatorResult]
Adds a header with the token as value to the result.
Adds a header with the token as value to the result.
- token
The token to embed.
- result
The result to manipulate.
- request
The request header.
- returns
The manipulated result.
- Definition Classes
- JWTAuthenticatorService → AuthenticatorService
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- implicit val executionContext: ExecutionContext
The execution context to handle the asynchronous operations.
The execution context to handle the asynchronous operations.
- Definition Classes
- JWTAuthenticatorService → ExecutionContextProvider
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def init(authenticator: JWTAuthenticator)(implicit request: RequestHeader): Future[String]
Creates a new JWT for the given authenticator and return it.
Creates a new JWT for the given authenticator and return it. If a backing store is defined, then the authenticator will be stored in it.
- authenticator
The authenticator instance.
- request
The request header.
- returns
The serialized authenticator value.
- Definition Classes
- JWTAuthenticatorService → AuthenticatorService
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val logger: api.Logger
A named logger instance.
A named logger instance.
- Definition Classes
- Logger
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def renew(authenticator: JWTAuthenticator, result: Result)(implicit request: RequestHeader): Future[AuthenticatorResult]
Renews an authenticator and replaces the JWT header with a new one.
Renews an authenticator and replaces the JWT header with a new one.
If a backing store is defined, the old authenticator will be revoked. After that, it isn't possible to use a JWT which was bound to this authenticator.
- authenticator
The authenticator to update.
- result
The result to manipulate.
- request
The request header.
- returns
The original or a manipulated result.
- Definition Classes
- JWTAuthenticatorService → AuthenticatorService
- def renew(authenticator: JWTAuthenticator)(implicit request: RequestHeader): Future[String]
Renews an authenticator.
Renews an authenticator.
After that it isn't possible to use a JWT which was bound to this authenticator. This method doesn't embed the the authenticator into the result. This must be done manually if needed or use the other renew method otherwise.
- authenticator
The authenticator to renew.
- request
The request header.
- returns
The serialized expression of the authenticator.
- Definition Classes
- JWTAuthenticatorService → AuthenticatorService
- Annotations
- @SuppressWarnings()
- def retrieve[B](implicit request: ExtractableRequest[B]): Future[Option[JWTAuthenticator]]
Retrieves the authenticator from request.
Retrieves the authenticator from request.
If a backing store is defined, then the authenticator will be validated against it.
- B
The type of the request body.
- request
The request to retrieve the authenticator from.
- returns
Some authenticator or None if no authenticator could be found in request.
- Definition Classes
- JWTAuthenticatorService → AuthenticatorService
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def touch(authenticator: JWTAuthenticator): Either[JWTAuthenticator, JWTAuthenticator]
Touches an authenticator.
Touches an authenticator.
An authenticator can use sliding window expiration. This means that the authenticator times out after a certain time if it wasn't used. So to mark an authenticator as used it will be touched on every request to a Silhouette action. If an authenticator should not be touched because of the fact that sliding window expiration is disabled, then it should be returned on the right, otherwise it should be returned on the left. An untouched authenticator needn't be updated later by the update method.
- authenticator
The authenticator to touch.
- returns
The touched authenticator on the left or the untouched authenticator on the right.
- Definition Classes
- JWTAuthenticatorService → AuthenticatorService
- def update(authenticator: JWTAuthenticator, result: Result)(implicit request: RequestHeader): Future[AuthenticatorResult]
Updates the authenticator and embeds a new token in the result.
Updates the authenticator and embeds a new token in the result.
To prevent the creation of a new token on every request, disable the idle timeout setting and this method will not be executed.
- authenticator
The authenticator to update.
- result
The result to manipulate.
- request
The request header.
- returns
The original or a manipulated result.
- Definition Classes
- JWTAuthenticatorService → AuthenticatorService
- 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])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)