you could use Plack::Builder;

append the following inside your app.psgi file

use Plack::Builder;

builder {
      enable "Auth::Basic", authenticator => \&authen_cb;
}

sub authen_cb {
      my($username, $password, $env) = @_;
      return ($username eq 'testuser' && $password eq 'testpassword')
}

On Fri, Feb 12, 2016 at 11:09 PM, WK <[email protected]> wrote:

> Hi!
>
> I try to run  one simple Dancer app behind Apache proxy and because
> there is a bunch of old CGI scripts running on same server, restricted
> by basic authentication, I'd like to use the same authentication
> scheme in Dancer app too.
>
> My Apache config looks like this:
>
> <Location /xyz/z >
>     ProxyPass http://localhost:5001
>     ProxyPassReverse http://localhost:5001
>     RequestHeader set Request-Base /xyz/z
>     AuthName "myadmin"
>     AuthType basic
>     AuthUserFile /etc/htpasswd.adm
>     Require valid-user
> </Location>
>
> So far, so good.
>
> Problem: in Dancer I can't access env variable REMOTE_USER.
>
> AFAIU Dancer::Request object does not forward this variable.  What is
> the best way to access REMOTE_USER value inside Dancer?
>
> Tia,
> --
> Wbr,
> Kõike hääd,
>
> Gunnar
> _______________________________________________
> dancer-users mailing list
> [email protected]
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

Reply via email to