http://qs321.pair.com?node_id=612286

artist has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
How I can have PHP_AUTH_USER and PHP_AUTH_PW type of variable using CGI? I am Not using mod_perl. Thanks,
--Artist

Replies are listed 'Best First'.
Re: PHP_AUTH_USER type authentication
by ikegami (Patriarch) on Apr 27, 2007 at 00:01 UTC

    Do those contain the Basic-Authentication / Digest-Authentication credentials? You can fetch the user name using $cgi->remote_user() or $ENV{REMOTE_USER}. The password, however, is not provided by CGI. (It wouldn't be there in the CGI version of PHP either.)

      Does it mean that there is no Perl equivalent for this?
      I like to get username/password and authenticate the user. I don't use any other module to authenticate. I can definitely use it if required. I am not familiar with authentication modules, so please point me in appropriate direction.

      Thanks,

      --Artist
        Hi artist

        In this case, Apache does the authentication for you so you don't need the password part. You may use the username part for other purpose such as custom authorization. You need no module for this authentication type, just Read The Fine Manual from Apache site:

        Authentication, Authorization and Access Control

        I never understand myself why PHP provides such thing.


        Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!