Trait

com.jaroop.play.sentry

IdContainer

Related Doc: package sentry

Permalink

trait IdContainer[Id] extends AnyRef

An IdContainer's job is to manage user sessions server-side. It is responsible for creating, destroying, validating, and prolonging existing sessions.

The basic workflow is:

1.) A user ID is passed to start a new session, and the IdContainer gives the user an AuthenticityToken in return. 2.) The user presents the AuthenticityToken as evidence that they are authenticated, and the IdContainer confirms the validity of the token. 3.) When presenting a valid AuthenticityToken, that token's session can be prolonged. 4.) When the user logs out, the IdContainer will no longer recognize their token as valid.

Id

The type of the user's ID, which is a primary identifier of a session.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. IdContainer
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def get(token: AuthenticityToken)(implicit ec: ExecutionContext): Future[Option[Id]]

    Permalink

    Finds the user ID that is associated with an AuthenticityToken.

    Finds the user ID that is associated with an AuthenticityToken. If Some[Id] is returned, that is sufficient to show that a user's session is valid.

    token

    The AuthenticityToken to verify.

    returns

    The user ID associated with the AuthenticityToken within the IdContainer, if there is one. Otherwise, None.

  2. abstract def prolongTimeout(token: AuthenticityToken, timeout: Duration)(implicit ec: ExecutionContext): Future[Unit]

    Permalink

    Delays the expiration of a session by a given duration.

    Delays the expiration of a session by a given duration.

    token

    The AuthenticityToken of the session to prolong.

    timeout

    The new duration of the session. e.g. if there is 30 minutes left in a session, and a timeout of one hour is passed, the session will expire in one hour.

    returns

    A successful Future if the session was prolonged, or a failed Future if the session isn't valid, or some other error occurred.

  3. abstract def remove(token: AuthenticityToken)(implicit ec: ExecutionContext): Future[Unit]

    Permalink

    Destroys the session identified by a given token.

    Destroys the session identified by a given token.

    token

    The AuthenticityToken that is paired with the session to be destroyed.

    returns

    A successful Future if the session was destroyed, or a failed Future if an error occurred.

  4. abstract def startNewSession(userId: Id, timeout: Duration)(implicit ec: ExecutionContext): Future[AuthenticityToken]

    Permalink

    Opens a new session for a user, and generates an AuthenticityToken that is paired with that user's ID.

    Opens a new session for a user, and generates an AuthenticityToken that is paired with that user's ID.

    userId

    The ID of the session the session will be created for.

    timeout

    How long the session will be valid before expiring in a stateful IdContainer.

    returns

    An AuthenticityToken to be given to the user to later verify their session is valid.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  16. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped