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 Secure(operation: Permissible, request: RequestType) extends Product with Serializable

Methods for handling requests with authentication and authorization.

Secures against a given operation Secure.operation.

operation

Permissible operation to secure against

request

RequestType incoming http request

Attributes
protected[org.hungerford.rbac]
Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Secure
  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 Secure(operation: Permissible, request: RequestType)

    operation

    Permissible operation to secure against

    request

    RequestType incoming http request

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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  8. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  9. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  10. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  12. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  13. val operation: Permissible
  14. val request: RequestType
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def tryWithPermission[T](handler: (Try[Permission]) ⇒ T): T

    Authenticates and authorizes request against an operation, and executes a handler to handle either authenticated permissions or exceptions returned by authentication or authorization.

    Authenticates and authorizes request against an operation, and executes a handler to handle either authenticated permissions or exceptions returned by authentication or authorization.

    T

    Return type of handler

    handler

    Try[Permission]=>T

    returns

    T

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

    Authenticates and authorizes request against an operation, and executes a handler to handle either authenticated roles or exceptions returned by authentication or authorization.

    Authenticates and authorizes request against an operation, and executes a handler to handle either authenticated roles or exceptions returned by authentication or authorization.

    T

    Return type of handler

    handler

    Try[Role]=>T

    returns

    T

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

    Authenticates and authorizes request against an operation, and executes a function to handle either authenticated user or exceptions returned by authentication or authorization.

    Authenticates and authorizes request against an operation, and executes a function to handle either authenticated user or exceptions returned by authentication or authorization.

    T

    Return type of handler

    handler

    Try[Role]=>T

    returns

    T

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

    Authenticates and authorizes request against an operation, executing a function to handle authenticated permissions.

    Authenticates and authorizes request against an operation, executing a function to handle authenticated permissions.

    T

    Return type of handler

    handler

    Permission=>T

    returns

    T

    Annotations
    @throws( ... ) @throws( ... )
    Exceptions thrown

    AuthenticationException if authentication fails

    AuthorizationException if authenticated permissions are not permitted to execute operation

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

    Authenticates and authorizes request against an operation, executing a function to handle authenticated role.

    Authenticates and authorizes request against an operation, executing a function to handle authenticated role.

    T

    Return type of handler

    handler

    Role=>T

    returns

    T

    Annotations
    @throws( ... ) @throws( ... )
    Exceptions thrown

    AuthenticationException if authentication fails

    AuthorizationException if authenticated role is not permitted to execute operation

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

    Authenticates and authorizes request against an operation, executing a function to handle authenticated user.

    Authenticates and authorizes request against an operation, executing a function to handle authenticated user.

    T

    Return type of handler

    handler

    UserType=>T

    returns

    T

    Annotations
    @throws( ... ) @throws( ... )
    Exceptions thrown

    AuthenticationException if authentication fails

    AuthorizationException if authenticated user is not permitted to execute operation

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped