From 24b3867f135b78e816d403dbb2768efd3ab7e471 Mon Sep 17 00:00:00 2001 From: Tatsuhiko Miyagawa Date: Thu, 25 Apr 2024 16:41:03 -0700 Subject: [PATCH] Add more example --- lib/Plack/Middleware/Auth/Basic.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/Plack/Middleware/Auth/Basic.pm b/lib/Plack/Middleware/Auth/Basic.pm index bc0945320..fa069c193 100644 --- a/lib/Plack/Middleware/Auth/Basic.pm +++ b/lib/Plack/Middleware/Auth/Basic.pm @@ -85,12 +85,21 @@ A callback function that takes username, password and PSGI environment supplied and returns whether the authentication succeeds. Required. Authenticator can also be an object that responds to C -method that takes username and password and returns boolean, so -backends for L is perfect to use: +method that takes username and password and returns boolean, so any +backends for L are perfect to use: use Authen::Simple::LDAP; enable "Auth::Basic", authenticator => Authen::Simple::LDAP->new(...); +For authentication based on C files: + + use Authen::Simple::Passwd; + enable "Auth::Basic", + realm => "Password protected area", + authenticator => Authen::Simple::Passwd->new( + path => "/path/to/.htpasswd", + ); + =item realm Realm name to display in the basic authentication dialog. Defaults to I.