This question about Authentication or Authorisation: Answered
How to create an alias for users when using Apache Login
Hi,
I'm running foswiki on IIS and I'm using
ApacheLogin, so the users are authenticating at the server with their username and password.
There is no login or registration page in Foswiki.
When a user is logged in the username is always DOMAIN\username and used as this for creating or editing topics.
That looks a ltittle weird and it would be nice if one could remove the DOMAIN part of the username. Or change it to an alias or so on.
There was a plugin for twiki a while ago, called
LoginNameAliasPlugin, but it's not working anymore.
Thx for any answer,
Fallback
Try
LdapContrib.
--
MichaelDaum - 25 May 2009
Thx for the tipp, looks promising, especially the "normalize" function.
But my
ActivePerl is missing an unicode "map.pm" for the
MapUTF8 package. Right now I'm figuring out how I can get this.
Edit:
I installed all missing packages (map, maputf8, net::ldap, db_file) but it's still not working.
There is only the error "db_file.dll can't load file: permission denied at
XsLoader.pm".
I think I have some big problems with the permission settings of the IIS / IUSR and Perl.
--
FallBack - 26 May 2009
I'm going to port
LoginNameAliasesPlugin and get you to test it, and i may extend that, or write something new later
Tasks/Item1812
--
SvenDowideit - 08 Jul 2009
If you like to remove IIS stuff added to the remote_user then try an
IISLogin LoginManager instead of the
ApacheLogin one.
The Implementation should look something like this (not tested)
use strict;
use base 'Foswiki::LoginManager::ApacheLogin';
sub loadSession {
my $this = shift;
my $authUser = $this->SUPER::loadSession(@_);
# remove DOMAIN
$authUser =~ s/.*\\(.*?)$/$1/g if defined $authUser;
return $authUser;
}
1;
Save as
lib/Foswiki/LoginManager/IISLogin.pm and activate via
configure
(fingers x-ed)
--
MichaelDaum - 08 Jul 2009
Thx for your help
MichaelDaum and
SvenDowideit. The fix is working!
But I couldn't use the IISLogin.pm and your code.
I had to copy the important line into the ApacheLogin.pm. Then it looks like this:
unless ( ( $ENV{REDIRECT_STATUS} || 0 ) >= 400 ) {
$authUser = $query->remote_user() if $query;
Foswiki::LoginManager::_trace( $this,
"apache getUser says " . ( $authUser || 'undef' ) );
$authUser =~ s/.*\\(.*?)$/$1/g if defined $authUser;
}
--
FallBack - 08 Jul 2009