Forum Moderators: coopster & phranque

Message Too Old, No Replies

User authentication

         

FiRe

8:42 am on Aug 10, 2005 (gmt 0)

10+ Year Member



How can I authenticate a user logging in to the intranet in Perl? It runs on a windows 2003 server and apache. When the user is authenticated I also need a way of retrieveing the username, to store as a cookie. Prefably this authentication has a popup box like when using htaccess files to access a protected directory.
Any code/links will be great.
Thanks :)

WWMike

9:46 pm on Aug 10, 2005 (gmt 0)

10+ Year Member



1) Create a file named .htpasswd that contains the appropriate username:encryptedpassword pair that you want to allow to have access:

john:/.%gu5ku3x

2) You will need to pre-encrypt the password so that it can be correctly decoded by Apache:

[euronet.nl...]

3) Place the .htpasswd file in a non-web-accessible area of your domain if possible.

4) Create a file named .htaccess that includes the following and place it in the folder you wish to protect:

AuthType Basic
AuthName "My Protected Area"
AuthUserFile "/usr/home/myaccount/users/mydomain.com/members/.htpasswd"
require valid-user

5) Change the AuthUserFile entry to correspond to the UNIX path where you placed the .htpasswd file.

6) Try to access that folder and you'll see a pop-up authorization prompt.

7) Search this forum for a cookie driver routine I've already provided to do your cookie stuff. You can get the authorized username from PERL with $ENV{REMOTE_USER}.

FiRe

8:02 am on Aug 11, 2005 (gmt 0)

10+ Year Member



Sorry I forgot to mention the usernames and passwords are already on the server (its in active directories), and I need to authenticate them to log in to the intranet.

FiRe

2:22 pm on Aug 11, 2005 (gmt 0)

10+ Year Member



never mind, i have found a module for it - [search.cpan.org...]