httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darly Senecal Baptiste <dsenec...@gmail.com>
Subject [users] mop_perl retrieving the Basic AuthType screen
Date Wed, 11 Jun 2014 15:26:45 GMT
Hi Community,

I am looking to implement a perl script that gathers the login information
(specifically, the username) before that information logs into the system.
My current setting is the following

PerlRequire /etc/httpd/conf/perl/startup.pl
> PerlModule MyApache2::Authm
> <Location "/git">
>     AuthType Basic
>      SetHandler perl-script
>     PerlAuthenHandler MyApache2::Authm::authn_handler
>     AuthName "My Git Repository"
>     AuthBasicProvider ldap-ny ldap-mia
>     AuthzLDAPAuthoritative off
>     AuthGroupFile /git/htgroups
>     Require valid-user
> </Location>


Sometimes, some users login as darly.senecal but others loging as
DOMAIN\darly.senecal.

I'm writing a perl module in which if the user logs in as DOMAIN\username,
then the script has to strip the DOMAIN\ and makes the username as login.
Otherwise, the script the skips the changes and logs in normally

This is my script (At this time)

package MyApache2::Authm;
> use warnings;
> use Apache2::Access ();
> use Apache2::RequestRec ();
> use Apache2::Const -compile => qw(OK DECLINED HTTP_UNAUTHORIZED);
> sub authn_handler
> {
>   my $r = shift;
>   #Get Authentication Credentials
>   my ($res, $sent_pw) = $r->get_basic_auth_pw;
>   if ($r->user =~ m/^(\QDOMAIN\\\E)/)
>   {
>     my @user = split(/\\/,$r->user);
>     $r->user($user[1]);
>     print "User: ", $r->user;
>     return Apache2::OK;
>   }
> }
> 1;


If you have any idea, please let me know

Regards

Mime
View raw message