Feature Proposal: Make Sure Wikiname Is WikiWord With OpenLDAP Authentication REMOTE_USER

Motivation

I have a OpenLDAP working fine and the foswiki authentication works fine, but que REMOTE_USER is not a WikiWord, then is not a Valid Topic Name. If the variable WIKINAME is derived from REMOTE_USER, this may be converted to WikiWord.

Description and Documentation

I recently migrated to Foswiki from TWiki and excluded all the user pages. Authentication is done only in OpenLDAP.

Examples

Our LDAP has the following attributes:
dn: uid=jarbas.peixoto,ou=Usuarios,dc=teste
givenName: Jarbas
sn: Peixoto
uid: jarbas.peixoto
mail: jarbas.peixoto@previdencia.gov.br
cn: Jarbas Peixoto Junior
o: DATAPREV

Apache has been configured to authenticate with the uid as follows
  • File /etc/foswiki/apache.conf
...
AuthType Basic
AuthName "Informe IDENTIFICADOR e SENHA do OpenLdap (Acesso Restrito para a DATAPREV)"
AuthBasicProvider "ldap" "file"
AuthLDAPURL "ldap://mmldap:389/ou=Usuarios,dc=teste?uid,mail,cn?sub?(|(objectClass=shadowAccount)(o=DATAPREV))"
AuthLDAPRemoteUserAttribute uid
AuthzLdapAuthoritative Off
AuthUserFile /var/lib/foswiki/data/.htpasswd
...

When authentication occurs, the WikiName is the uid is not a WikiWord. Then the automatic creation of User Topic does not work.

Impact

%WHATDOESITAFFECT%
edit

Implementation

I made a small change to the uid is a WikiWord
  • File /var/lib/foswiki/lib/Foswiki/Users.pm
...
        # needs to be WikiName safe
        #BEGIN: uppercase fisrt char (jarbas.junior@gmail.com)
        my @words;
        @words = ( $this->{cUID2WikiName}->{$cUID} =~ /(\w+)(\W?)/g );
        for (my $i = 0; $i < @words; $i++) {
                $words[$i]=ucfirst($words[$i]);
        }
        $this->{cUID2WikiName}->{$cUID} = join("",@words);
        #END: uppercase first char (jarbas.junior@gmail.com)
        $this->{cUID2WikiName}->{$cUID} =~ s/$Foswiki::cfg{NameFilter}//go;
...

Now, when authentication is the User Topic is created normally and I use the permission of local groups.

-- Contributors: JarbasJunior - 09 Sep 2010

Discussion

Topic revision: r3 - 03 Nov 2015, GeorgeClark
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