This question about Authentication or Authorisation: Answered

How to create an alias for users when using Apache Login


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,


Try LdapContrib.

-- MichaelDaum - 25 May 2009

Thx for the tipp, looks promising, especially the "normalize" function.

But my ActivePerl is missing an unicode "" for the MapUTF8 package. Right now I'm figuring out how I can get this.


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".

I think I have some big problems with the permission settings of the IIS / IUSR and Perl. frown, sad smile

-- 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


-- 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;

Save as lib/Foswiki/LoginManager/ 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 and your code.

I had to copy the important line into the 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

QuestionForm edit

Subject Authentication or Authorisation
Status Answered
Topic revision: r7 - 08 Jul 2009, FallBack
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy