These docs are for v3.0. Click to read the latest docs for v7.0.

Authenticators

CookieAuthenticator

To configure the CookieAuthenticator service you must use the CookieAuthenticatorSettings class. This class has the following form:

case class CookieAuthenticatorSettings(
  cookieName: String = "id",
  cookiePath: String = "/",
  cookieDomain: Option[String] = None,
  secureCookie: Boolean = true,
  httpOnlyCookie: Boolean = true,
  encryptAuthenticator: Boolean = true,
  useFingerprinting: Boolean = true,
  cookieMaxAge: Option[FiniteDuration] = None,
  authenticatorIdleTimeout: Option[FiniteDuration] = None,
  authenticatorExpiry: FiniteDuration = 12 hours)
PropertyDescription
cookieNameThe cookie name
cookiePathThe cookie path
cookieDomainThe cookie domain
secureCookie

Whether this cookie is secured, sent only for HTTPS requests.

Note:
This should be disabled for testing on localhost without SSL, otherwise cookie couldn't be set

httpOnlyCookieWhether this cookie is HTTP only, i.e. not accessible from client-side JavaScript code
encryptAuthenticatorIndicates if the authenticator should be encrypted in the cookie
useFingerprintingIndicates if a fingerprint of the user should be stored in the authenticator
cookieMaxAgeThe duration a cookie expires. None for a transient cookie
authenticatorIdleTimeoutThe duration an authenticator can be idle before it timed out
authenticatorExpiryThe duration an authenticator expires after it was created

Example

authenticator.cookieName = "authenticator"
authenticator.cookiePath = "/"
authenticator.secureCookie = false
authenticator.httpOnlyCookie = true
authenticator.useFingerprinting = true
authenticator.authenticatorIdleTimeout = 30 minutes
authenticator.authenticatorExpiry = 12 hours

SessionAuthenticator

To configure the SessionAuthenticator service you must use the SessionAuthenticatorSettings class. This class has the following form:

case class SessionAuthenticatorSettings(
  sessionKey: String = "authenticator",
  encryptAuthenticator: Boolean = true,
  useFingerprinting: Boolean = true,
  authenticatorIdleTimeout: Option[FiniteDuration] = None,
  authenticatorExpiry: FiniteDuration = 12 hours)
PropertyDescription
sessionKeyThe key of the authenticator in the session
encryptAuthenticatorIndicates if the authenticator should be encrypted in session
useFingerprintingIndicates if a fingerprint of the user should be stored in the
authenticatorIdleTimeoutThe duration an authenticator can be idle before it timed out
authenticatorExpiryThe duration an authenticator expires after it was created

Example

authenticator.sessionKey = "authenticator"
authenticator.encryptAuthenticator = true
authenticator.useFingerprinting = true
authenticator.authenticatorIdleTimeout = 30 minutes
authenticator.authenticatorExpiry = 12 hours

BearerTokenAuthenticator

To configure the BearerTokenAuthenticator service you must use the BearerTokenAuthenticatorSettings class. This class has the following form:

case class BearerTokenAuthenticatorSettings(
  headerName: String = "X-Auth-Token",
  authenticatorIdleTimeout: Option[FiniteDuration] = None,
  authenticatorExpiry: FiniteDuration = 12 hours)
PropertyDescription
headerNameThe name of the header in which the token will be transfered
authenticatorIdleTimeoutThe duration an authenticator can be idle before it timed out
authenticatorExpiryThe duration an authenticator expires after it was created

Example

authenticator.headerName = "X-Auth-Token"
authenticator.authenticatorIdleTimeout = 30 minutes
authenticator.authenticatorExpiry = 12 hours

JWTAuthenticator

To configure the JWTAuthenticator service you must use the JWTAuthenticatorSettings
class. This class has the following form:

case class JWTAuthenticatorSettings(
  headerName: String = "X-Auth-Token",
  issuerClaim: String = "play-silhouette",
  encryptSubject: Boolean = true,
  authenticatorIdleTimeout: Option[FiniteDuration] = None,
  authenticatorExpiry: FiniteDuration = 12 hours,
  sharedSecret: String)
PropertyDescription
headerNameThe name of the header in which the token will be transfered
issuerClaimThe issuer claim identifies the principal that issued the JWT
encryptSubjectIndicates if the subject should be encrypted in JWT
authenticatorIdleTimeoutThe duration an authenticator can be idle before it times out
authenticatorExpiryThe duration an authenticator expires after it was created
sharedSecretThe shared secret to sign the JWT

Example

authenticator.headerName = "X-Auth-Token"
authenticator.issuerClaim = "play-angular-silhouette"
authenticator.encryptSubject = true
authenticator.authenticatorExpiry = 12 hours
authenticator.sharedSecret = "changeme"