All Downloads are FREE. Search and download functionalities are using the official Maven repository.

be.objectify.deadbolt.scala.DeadboltHandler.scala Maven / Gradle / Ivy

There is a newer version: 2.7.1
Show newest version
package be.objectify.deadbolt.scala

import play.api.mvc.{Request, Result}
import be.objectify.deadbolt.core.models.Subject
import scala.concurrent.Future

/**
 *
 * @author Steve Chaloner ([email protected])
 */

trait DeadboltHandler {

  /**
   * Invoked prior to a constraint's test.  If Option.None is returned, the constraint is applied. If
   * the option contains a result, the constraint will not be applied and the wrapped action will not
   * be invoked.
   *
   * @return an option possible containing a Result.
   */
  def beforeAuthCheck[A](request: Request[A]): Option[Future[Result]]

  /**
   * Gets the current subject e.g. the current user.
   *
   * @return a future for an option containing the current subject
   */
  def getSubject[A](request: Request[A]): Future[Option[Subject]]

  /**
   * Invoked when an authorisation failure is detected for the request.
   *
   * @return the action
   */
  def onAuthFailure[A](request: Request[A]): Future[Result]

  /**
   * Gets the handler used for dealing with resources restricted to specific users/groups.
   *
   * @return an option containing the handler for restricted resources
   */
  def getDynamicResourceHandler[A](request: Request[A]): Option[DynamicResourceHandler]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy