Module: Turnstile-Perfect
struct AuthenticationConfig
Sets up the matrix of which routes are checked for authentication, and which are not.
var inclusions = [String]()
An array of routes that are checked for valid authentication.
var exclusions = [String]()
An array of routes that will not be checked.
var denied: String?
Unimplemented. Will optionally provide a location for access denied redirection.
func mutating func include(_ str: String)
Add a route as a string to the array of inclusions
func mutating func include(_ arr: [String])
Add a an array of strings (as routes) to the array of inclusions
func mutating func exclude(_ str: String)
Add a route as a string to the array of exclusions
func mutating func exclude(_ arr: [String])
Add a an array of strings (as routes) to the array of exclusions
struct AuthFilter: HTTPRequestFilter
Contains the filtering mechanism for determining valid authentication on routes.
func init(_ cfg: AuthenticationConfig)
Accept an auth config via init.
func filter(request: HTTPRequest, response: HTTPResponse, callback: (HTTPRequestFilterResult) -> ())
Perform the filtering, with a callback allowing continuation of request, or galting immediately.
class TurnstileFilter
The filter container class for Turnstile
extension TurnstileFilter
func filterHeaders(response: HTTPResponse, callback: (HTTPResponseFilterResult) -> ())
Called once before headers are sent to the client. If needed, sets the cookie with the session id.
func filterBody(response: HTTPResponse, callback: (HTTPResponseFilterResult) -> ())
Called zero or more times for each bit of body data which is sent to the client.