class BasicAuthMiddleware implements HTTPMiddleware (View source)

Properties

protected array $urlPatterns

URL Patterns for basic auth. Keys are the Regexp string to match, and the key can be one of the below:

  • true (bool) - Enabled for this url
  • false (bool) - Disabled for this url
  • Any string / array - Enabled for this url, and require the given string as a permission code
  • null (default) - Calls BasicAuth::protect_site_if_necessary(), which falls back to config setting

Methods

public
process(HTTPRequest $request, callable $delegate)

Generate response for the given request

public
array
getURLPatterns()

Get list of url patterns

public
$this
setURLPatterns(array $urlPatterns)

No description

protected
bool|string|array|null
checkMatchingURL(HTTPRequest $request)

Check if global basic auth is enabled for the given request

Details

HTTPResponse process(HTTPRequest $request, callable $delegate)

Generate response for the given request

Parameters

HTTPRequest $request
callable $delegate

Return Value

HTTPResponse

array getURLPatterns()

Get list of url patterns

Return Value

array

$this setURLPatterns(array $urlPatterns)

No description

Parameters

array $urlPatterns

Return Value

$this

protected bool|string|array|null checkMatchingURL(HTTPRequest $request)

Check if global basic auth is enabled for the given request

Parameters

HTTPRequest $request

Return Value

bool|string|array|null

boolean value if enabled/disabled explicitly for this request, or null if should fall back to config value. Can also provide an explicit string / array of permission codes to require for this requset.