Class

com.jaroop.play.sentry

AuthenticatedActionBuilder

Related Doc: package sentry

Permalink

class AuthenticatedActionBuilder[E <: Env] extends ActionBuilder[[α$0$]AuthRequest[α$0$, sentry.AuthenticatedActionBuilder.E.User], AnyContent]

An ActionBuilder for endpoints where authentication or authorization is required.

This is one of the main components that will be used in an application. To use, you can simply just inject this component into your controller with a specified Env type.

@Singleton
class HomeController @Inject() (
    action: AuthenticatedActionBuilder[EnvImpl]
) extends InjectedController {
    def index = action { request =>
        Ok(s"You are logged-in as ${request.user}!")
    }
}
E

The environment type of your application.

Self Type
AuthenticatedActionBuilder[E]
Linear Supertypes
ActionBuilder[[α$0$]AuthRequest[α$0$, E.User], AnyContent], ActionFunction[Request, [α$0$]AuthRequest[α$0$, E.User]], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AuthenticatedActionBuilder
  2. ActionBuilder
  3. ActionFunction
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new AuthenticatedActionBuilder(parser: Default, config: AuthConfig[E], auth: AsyncAuth[E])(implicit executionContext: ExecutionContext)

    Permalink

    parser

    Uses the default BodyParser, but can be overridden with the ActionBuilder interface.

    config

    Requires an AuthConfig for success and failure behavior for authentication.

    auth

    Requires the AsyncAuth component for resolving a user and authorizing.

    Annotations
    @Inject()

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. def andThen[Q[_]](other: ActionFunction[[α$0$]AuthRequest[α$0$, E.User], Q]): ActionBuilder[Q, AnyContent]

    Permalink
    Definition Classes
    ActionBuilder → ActionFunction
  5. final def apply(block: ⇒ Result): Action[AnyContent]

    Permalink
    Definition Classes
    ActionBuilder
  6. final def apply(block: (AuthRequest[AnyContent, E.User]) ⇒ Result): Action[AnyContent]

    Permalink
    Definition Classes
    ActionBuilder
  7. final def apply[A](bodyParser: BodyParser[A]): ActionBuilder[[α$0$]AuthRequest[α$0$, E.User], A]

    Permalink
    Definition Classes
    ActionBuilder
  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. final def async[A](bodyParser: BodyParser[A])(block: (AuthRequest[A, E.User]) ⇒ Future[Result]): Action[A]

    Permalink
    Definition Classes
    ActionBuilder
  10. final def async(block: (AuthRequest[AnyContent, E.User]) ⇒ Future[Result]): Action[AnyContent]

    Permalink
    Definition Classes
    ActionBuilder
  11. final def async(block: ⇒ Future[Result]): Action[AnyContent]

    Permalink
    Definition Classes
    ActionBuilder
  12. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. def compose[B](other: ActionBuilder[Request, B]): ActionBuilder[[α$0$]AuthRequest[α$0$, E.User], B]

    Permalink
    Definition Classes
    ActionFunction
  14. def compose[Q[_]](other: ActionFunction[Q, Request]): ActionFunction[Q, [α$0$]AuthRequest[α$0$, E.User]]

    Permalink
    Definition Classes
    ActionFunction
  15. def composeAction[A](action: Action[A]): Action[A]

    Permalink
    Attributes
    protected
    Definition Classes
    ActionBuilder
  16. def composeParser[A](bodyParser: BodyParser[A]): BodyParser[A]

    Permalink
    Attributes
    protected
    Definition Classes
    ActionBuilder
  17. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  19. implicit val executionContext: ExecutionContext

    Permalink
    Definition Classes
    AuthenticatedActionBuilder → ActionFunction
  20. def finalize(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  23. def invokeBlock[A](request: Request[A], block: (AuthRequest[A, E.User]) ⇒ Future[Result]): Future[Result]

    Permalink

    The default implementation of an ActionBuilder with enforced authentication.

    The default implementation of an ActionBuilder with enforced authentication. It attempts to verify that the user is logged-in based on the Request, and allows the action to proceed if they are. The body of the produced Action accepts a AuthRequest[A, User] => Future[Result], which will allow the action to access the user's details, if needed.

    request

    The incoming request from the user.

    block

    A function to invoke if the user is authenticated. e.g. The body of a controller method.

    returns

    If the user is authenticated, then the Result of the block function is returned, along with updated cookies to prolong their session. If the user is not authenticated, then they receive the Result as configured by the available AuthConfig.

    Definition Classes
    AuthenticatedActionBuilder → ActionFunction
  24. final def isInstanceOf[T0]: Boolean

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

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

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

    Permalink
    Definition Classes
    AnyRef
  28. val parser: Default

    Permalink

    Uses the default BodyParser, but can be overridden with the ActionBuilder interface.

    Uses the default BodyParser, but can be overridden with the ActionBuilder interface.

    Definition Classes
    AuthenticatedActionBuilder → ActionBuilder
  29. final def synchronized[T0](arg0: ⇒ T0): T0

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. def withAuthorization(authority: E.Authority): ActionBuilder[[α$1$]AuthRequest[α$1$, E.User], AnyContent]

    Permalink

    Creates an ActionBuilder with enforced authorization.

    Creates an ActionBuilder with enforced authorization. First, it verifies that the user is authenticated, then it checks whether or not the user is authorized against the given authority key.

    authority

    The authority key the user should be authorized against.

    returns

    An ActionBuilder whose invoke block will only be executed if the user is authenticated and authorized for for the given authority key. If the user is not authorized, then they receive the Result as configured by the available AuthConfig.

Inherited from ActionBuilder[[α$0$]AuthRequest[α$0$, E.User], AnyContent]

Inherited from ActionFunction[Request, [α$0$]AuthRequest[α$0$, E.User]]

Inherited from AnyRef

Inherited from Any

Ungrouped