const classafSleepSafe::SleepSafeMiddleware

sys::Obj
  afSleepSafe::SleepSafeMiddleware : afBedSheet::Middleware

BedSheet middleware that invokes the Guards.

SleepSafeMiddleware is contributed with the following:

@Contribute { serviceType=MiddlewarePipeline# }
Void contributeMiddleware(Configuration config, SleepSafeMiddleware middleware) {
    config.set("afSleepSafe.guards", middleware).after("afBedSheet.assets").before("afBedSheet.routes")
}

Assets are not purposely not protected to prevent HTTP sessions being loaded (potentially from a database) on every request. Override Middleware ordering to change this behaviour.

guards

Source

const Guard[] guards

The Guards used to protect / reject each HTTP request.

rejectSuspectedAttack

Source

virtual Void rejectSuspectedAttack(Obj errObj)

Override hook to respond to failed Guard checks. Defaults to logging the msg (at warn level) and processes a 403 status.

shouldGuardRequest

Source

virtual Bool shouldGuardRequest(HttpRequest httpReq)

Override hook to optionally exempt HTTP requests from being guarded by SleepSafe. Sometimes you want to exclude URLs from being processed, this override hook lets you do that by optionally returning false.

This method defaults to returning true.