IpRateLimitFilter

com.digitaltangible.playguard.IpRateLimitFilter
abstract class IpRateLimitFilter[R <: (Request)](rateLimiter: RateLimiter, ipWhitelist: Set[String])(implicit ec: ExecutionContext) extends RateLimitActionFilter[R]

ActionFilter which holds a RateLimiter with a bucket for each IP address. Every request consumes a token. If no tokens remain, the request is rejected.

Attributes

Graph
Supertypes
trait ActionFilter[R]
trait ActionRefiner[R, R]
trait ActionFunction[R, R]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def bypass[A](implicit request: R[A]): Boolean

Attributes

Definition Classes
override def keyFromRequest[A](implicit request: R[A]): String

Attributes

Definition Classes

Inherited methods

def andThen[Q[_]](other: ActionFunction[R, Q]): ActionFunction[R, Q]

Compose this ActionFunction with another, with this one applied first.

Compose this ActionFunction with another, with this one applied first.

Value parameters

other

ActionFunction with which to compose

Attributes

Returns

The new ActionFunction

Inherited from:
ActionFunction
def compose[B](other: ActionBuilder[R, B]): ActionBuilder[P, B]

Attributes

Inherited from:
ActionFunction
def compose[Q[_]](other: ActionFunction[Q, R]): ActionFunction[Q, P]

Compose another ActionFunction with this one, with this one applied last.

Compose another ActionFunction with this one, with this one applied last.

Value parameters

other

ActionFunction with which to compose

Attributes

Returns

The new ActionFunction

Inherited from:
ActionFunction
def filter[A](request: R[A]): Future[Option[Result]]

Determine whether to process a request. This is the main method that an ActionFilter has to implement. It can decide to immediately intercept the request and return a Result (Some), or continue processing (None).

Determine whether to process a request. This is the main method that an ActionFilter has to implement. It can decide to immediately intercept the request and return a Result (Some), or continue processing (None).

Value parameters

request

the input request

Attributes

Returns

An optional Result with which to abort the request

Inherited from:
RateLimitActionFilter
final def invokeBlock[A](request: R[A], block: R[A] => Future[Result]): Future[Result]

Invoke the block. This is the main method that an ActionBuilder has to implement, at this stage it can wrap it in any other actions, modify the request object or potentially use a different class to represent the request.

Invoke the block. This is the main method that an ActionBuilder has to implement, at this stage it can wrap it in any other actions, modify the request object or potentially use a different class to represent the request.

Value parameters

block

The block of code to invoke

request

The request

Attributes

Returns

A future of the result

Inherited from:
ActionRefiner
final protected def refine[A](request: R[A]): Future[Either[Result, R[A]]]

Determine how to process a request. This is the main method than an ActionRefiner has to implement. It can decide to immediately intercept the request and return a Result (Left), or continue processing with a new parameter of type P (Right).

Determine how to process a request. This is the main method than an ActionRefiner has to implement. It can decide to immediately intercept the request and return a Result (Left), or continue processing with a new parameter of type P (Right).

Value parameters

request

the input request

Attributes

Returns

Either a result or a new parameter to pass to the Action block

Inherited from:
ActionFilter
def rejectResponse[A](implicit request: R[A]): Future[Result]

Attributes

Inherited from:
RateLimitActionFilter

Implicits

Inherited implicits

implicit val executionContext: ExecutionContext

Attributes

Returns

The execution context to run the request in.

Inherited from:
RateLimitActionFilter