vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Function checkBasicAuth

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

bool checkBasicAuth (
  scope HTTPServerRequest req,
  scope @safe bool delegate(string, string) pwcheck
) @safe;

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

Parameters

NameDescription
req Request object that is to be checked
pwcheck A delegate queried for validating user/password pairs

Returns

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.

Authors

Sönke Ludwig

Copyright

© 2012 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.