checkBasicAuth

Checks for valid HTTP Basic Auth authentication on the given request.

Upon successful authorization, the name of the authorized user will be stored in req.username.

@safe
bool
checkBasicAuth

Parameters

req HTTPServerRequest

Request object that is to be checked

pwcheck PasswordVerifyCallback

A delegate queried for validating user/password pairs

Return Value

Type: bool

Returns true iff a valid Basic Auth header is present and the credentials were verified successfully by the validation callback.

Throws

Throws a HTTPStatusExeption with HTTPStatusCode.badRequest if the "Authorization" header is malformed.

Meta