Package

be.objectify.deadbolt.scala

filters

Permalink

package filters

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. filters
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. case class AuthorizedRoute(method: Option[String], pathPattern: String, constraint: FilterFunction, handler: Option[DeadboltHandler] = None) extends Product with Serializable

    Permalink

    Defines a route, as defined by its post-compilation path and its method.

    Defines a route, as defined by its post-compilation path and its method. If the method is None, the match is purely on the path.

    The path pattern is the post-compilation path. For a path with no dynamic parts, this will be the same as what is defined in the routes file. For a path with dynamic parts, this will be different. For example, given the following route.

    GET     /view/:foo/:bar             controllers.Application.view(foo: String, bar: String)
    

    The post-compilation pattern will be the following:

    GET /view/$foo<[^/]+>/$bar<[^/]+> controllers.Application.view(foo:String, bar:String)
    

    If you bring up a list of the routes in the running application (just go to an invalid route, like http://localhost:9000/@foo), you can copy and paste the route patterns from here.

    method

    the method of the route. See the be.objectify.deadbolt.scala.filters package object for pre-defined methods

    pathPattern

    the post-compilation path pattern.

    constraint

    the constraint to apply to the route.

    handler

    the handler to use for the request. If None, the default handler (as defined by HandlerCache.apply() will be used.

    Since

    2.5.1

  2. abstract class AuthorizedRoutes extends (String, String) ⇒ Option[AuthorizedRoute]

    Permalink

    Holds the authorized route definitions, and attempts to find one based on the method (if defined) and path, or just the path if the route's method is None.

    Holds the authorized route definitions, and attempts to find one based on the method (if defined) and path, or just the path if the route's method is None.

    Extend this class and implement the routes function with a Seq of authorization rules, e.g.

      val routes: Seq[AuthorizedRoute] = Seq(AuthorizedRoute(Get, "/view/$foo<[^/]+>/$bar<[^/]+>", filterConstraints.subjectPresent),
                                             AuthorizedRoute(Any, "/profile", filterConstraints.dynamic("ruleName")))
    

    If you're using runtime dependency injection, you will also need to create a binding for your extended class, e.g.

    bind[AuthorizedRoutes].to[MyAuthorizedRoutes]
    

    Since

    2.5.1

  3. trait DeadboltFilterComponents extends DeadboltComponents

    Permalink

    Individual components of Deadbolt's filter support.

    Individual components of Deadbolt's filter support. Use this trait if your application uses compile-time dependency injection.

    Since

    2.5.1

  4. class DeadboltRouteCommentFilter extends Filter

    Permalink

    Filters all incoming HTTP requests and applies constraints based on the route's comment.

    Filters all incoming HTTP requests and applies constraints based on the route's comment. If a comment is present, the constraint for that route will be applied. If access is allowed, the next filter in the chain is invoked; if access is not allowed, be.objectify.deadbolt.scala.DeadboltHandler.onAuthFailure() is invoked.

    The format of the comment is deadbolt:constraintType:config. Individual configurations have the form :label[value] - to omit an optional config, remove :label[value],

    • deadbolt:subjectPresent:handler[handler name]
    • handler - optional. The name of a handler in the HandlerCache
    • deadbolt:subjectNotPresent:handler[handler name]
    • name - required. This is the name passed to DeadboltHandler#isAllowed
    • deadbolt:dynamic:name[constraint name]:handler[handler name]
    • name - required. This is the name passed to DeadboltHandler#isAllowed
    • handler - optional. The name of a handler in the HandlerCache
    • deadbolt:pattern:value[constraint value]:type[EQUALITY|REGEX|CUSTOM]:invert[true|false]:handler[handler name]
    • value - required. Used to test the permissions of a subject.
    • type - required. The pattern type, case sensitive.
    • invert - optional. Defines if the result should be flipped, i.e. a matching permission mean unauthorized. Defaults to false.
    • handler - optional. The name of a handler in the HandlerCache
    • deadbolt:composite:name[constraint name]:handler[handler name]
    • name - required. The name of a constraint in CompositeCache.
    • handler - optional. The name of a handler in the HandlerCache
    • deadbolt:restrict:name[constraint name]:handler[handler name]
    • name - required. The name of a constraint in the CompositeCache
    • handler - optional. The name of a handler in the HandlerCache
    • deadbolt:rbp:name[role name]:handler[handler name]
    • role name - required. The role name passed to DeadboltHandler#getPermissionsForRole
    • handler - optional. The name of a handler in the HandlerCache

    Restrict is a tricky one, because the possible combinations of roles leads to a nightmare to parse. Instead, define your role constraints within the composite cache and use the named constraint instead. deadbolt:restrict is actually a synonym for deadbolt:composite.

    Since

    2.5.1

  5. class DeadboltRouteCommentFilterModule extends Module

    Permalink

    Bindings for run-time dependency injection.

    Bindings for run-time dependency injection. Enable this module in your application.conf to get access to the route comment filter components.

    Since

    2.5.1

  6. class DeadboltRoutePathFilter extends Filter

    Permalink

    Filters all incoming HTTP requests and matches the method and/or path (depending on the AuthorizedRoute definition).

    Filters all incoming HTTP requests and matches the method and/or path (depending on the AuthorizedRoute definition). If a match is found, the constraint for that route will be applied. If access is allowed, the next filter in the chain is invoked; if access is not allowed, be.objectify.deadbolt.scala.DeadboltHandler.onAuthFailure() is invoked.

    Since

    2.5.1

  7. class DeadboltRoutePathFilterModule extends Module

    Permalink

    Bindings for run-time dependency injection.

    Bindings for run-time dependency injection. Enable this module in your application.conf to get access to the route path filter components.

    Since

    2.5.1

  8. class FilterConstraints extends AnyRef

    Permalink

    Provides helpers for creating filter-based constraints.

    Provides helpers for creating filter-based constraints.

    Annotations
    @Singleton()
    Since

    2.5.1

  9. trait FilterFunction extends (RequestHeader, AuthenticatedRequest[AnyContent], DeadboltHandler, (RequestHeader) ⇒ Future[Result]) ⇒ Future[Result]

    Permalink

    Implementations are used to represent Deadbolt constraints.

    Implementations are used to represent Deadbolt constraints. See FilterConstraints for implementations of all of Deadbolt's constraint types.

    Since

    2.5.1

  10. case class SimpleHandlerKey(name: String) extends HandlerKey with Product with Serializable

    Permalink

Value Members

  1. val Any: None.type

    Permalink
  2. val Delete: Some[String]

    Permalink
  3. val Get: Some[String]

    Permalink
  4. val Head: Some[String]

    Permalink
  5. val Options: Some[String]

    Permalink
  6. val Patch: Some[String]

    Permalink
  7. val Post: Some[String]

    Permalink
  8. val Put: Some[String]

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped