Function performBasicAuth

Overload group

Returns a request handler that enforces request to be authenticated using HTTP Basic Auth.

Prototypes

void delegate(HttpServerRequest req, HttpServerResponse res) performBasicAuth(
  string realm,
  bool delegate(string user, string name) pwcheck
);

Overload group

Enforces HTTP Basic Auth authentication on the given req/res pair.

Prototypes

string performBasicAuth(
  HttpServerRequest req,
  HttpServerResponse res,
  string realm,
  bool delegate(string user, string name) pwcheck
);

Parameters

Parameter nameDescription
req Request object that is to be checked
res Response object that will be used for authentication errors
realm HTTP Basic Auth realm reported to the client
pwcheck A delegate queried for validating user/password pairs

Returns

Returns the name of the authenticated user.

Throws

Throws a HttpStatusExeption in case of an authentication failure.

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.