Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package hungerford
    Definition Classes
    org
  • package rbac
    Definition Classes
    hungerford
  • trait SecureController[RequestType, UserType <: User] extends AnyRef

    Provides utility methods for managing authentication and authorization in REST controllers.

    Provides utility methods for managing authentication and authorization in REST controllers.

    RequestType

    Type of request handled by controller

    UserType

    Subtype of User

    Definition Classes
    rbac
    Examples:
    1. class MyScalatraServlet extends ScalatraServlet with SecureController[ HttpServletRequest ]

    2. ,
    3. class SecureAbstractController @Inject() ( cc: ControllerComponents ) extends AbstractController( cc ) with SecureController[ Request[ AnyContent ] ]

  • Authenticate
  • Secure

case class Authenticate(request: RequestType) extends Product with Serializable

Methods for handling requests with authentication.

request

RequestType

Attributes
protected[org.hungerford.rbac]
Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Authenticate
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Authenticate(request: RequestType)

    request

    RequestType

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply[T](block: ⇒ T): T

    Authenticates a request and either executes a given code block or throws an exception.

    Authenticates a request and either executes a given code block or throws an exception.

    T

    code block result type

    block

    code you want executed

    Annotations
    @throws( ... )
    Exceptions thrown

    AuthenticationException if authentication fails

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. val request: RequestType
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def tryTo[T](block: (Option[Throwable]) ⇒ T): T

    Authenticates a request and executes a given function that can handle auth exceptions if they arise.

    Authenticates a request and executes a given function that can handle auth exceptions if they arise.

    T

    code block result type

    block

    Option[Throwable]=>T code you want executed that handles auth exceptions

  17. def tryWithPermission[T](handler: (Try[Permission]) ⇒ T): T

    Authenticates a request and executes a given code block, passing to it either an authenticated permission instance or an exception if authentication fails

    Authenticates a request and executes a given code block, passing to it either an authenticated permission instance or an exception if authentication fails

    T

    code block result type

    handler

    Try[Permission]=>T code you want executed

  18. def tryWithRole[T](handler: (Try[Role]) ⇒ T): T

    Authenticates a request and executes a given code block, passing to it either the authenticated role instance or an exception if authentication fails

    Authenticates a request and executes a given code block, passing to it either the authenticated role instance or an exception if authentication fails

    T

    code block result type

    handler

    Try[Role]=>T code you want executed

  19. def tryWithUser[T](handler: (Try[UserType]) ⇒ T): T

    Authenticates a request and executes a given code block, passing to it either the authenticated user instance or an exception if authentication fails

    Authenticates a request and executes a given code block, passing to it either the authenticated user instance or an exception if authentication fails

    T

    code block result type

    handler

    Try[User]=>T code you want executed

  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  23. def withPermission[T](handler: (Permission) ⇒ T): T

    Authenticates a request and passes retrieved permission to a given code block or throws an exception if authentication fails.

    Authenticates a request and passes retrieved permission to a given code block or throws an exception if authentication fails.

    T

    code block result type

    handler

    Permission=>T code you want executed

    Annotations
    @throws( ... )
    Exceptions thrown

    AuthenticationException if authentication fails

  24. def withRole[T](handler: (Role) ⇒ T): T

    Authenticates a request and passes retrieved role to a given code block or throws an exception if authentication fails.

    Authenticates a request and passes retrieved role to a given code block or throws an exception if authentication fails.

    T

    code block result type

    handler

    Role=>T code you want executed

    Annotations
    @throws( ... )
    Exceptions thrown

    AuthenticationException if authentication fails

  25. def withUser[T](handler: (UserType) ⇒ T): T

    Authenticates a request and passes retrieved user to a given code block or throws an exception if authentication fails.

    Authenticates a request and passes retrieved user to a given code block or throws an exception if authentication fails.

    T

    code block result type

    handler

    User=>T code you want executed

    Annotations
    @throws( ... )
    Exceptions thrown

    AuthenticationException if authentication fails

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped