Skip to content

Commit

Permalink
Item1812: remove REMOTE_ADDR restriction and change the docco a little
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/LoginNameAliasesPlugin@4477 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Jul 8, 2009
1 parent 4e6a25b commit 88d780a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
22 changes: 11 additions & 11 deletions data/System/LoginNameAliasesPlugin.txt
@@ -1,19 +1,15 @@
%META:TOPICINFO{author="cbs" date="1090800134" format="1.0" version="1.1"}%

---+ <nop>LoginNameAliasesPlugin

This plugin is used to map login names (typically determined by the REMOTE_USER
variable set by the web server) to usernames. Most settings for the plugin are
controlled on this page.

*IMPORTANT: For security reasons, this page should only be editable by people in the %MAINWEB%.AdminGroup.*

variable set by the web server) to usernames.

---+ !LoginNameAliasesPlugin documentation
In an intranet
mechanisms (<nop>PubCookie, for example) and users are identified to Foswiki via
a REMOTE_USER variable that is set by such a mechanism. This can lead to the following issues:
In an intranet (<nop>PubCookie, windows Domains etc) users are identified to Foswiki via
a REMOTE_USER variable that is set by the webserver. This can lead to the following issues:

* This remote user variable may not be suitable for direct use as a Foswiki login name (e.g. it may contain special characters).
* This remote user value may not be suitable for direct use as a Foswiki login name
* e.g. it may contain special characters, or be a windows Domain such as WORKGROUP/UserName
* The same person may connect to Foswiki via various authentication domains or methods. For example, !JohnSmith may connect both as jsmith@DOMAIN1 and johns@DOMAIN2, and should be identified as the same user to Foswiki.
* Non-registered but identified users may connect to Foswiki in this way
and one may wish to map such users to a particular registered user.
Expand Down Expand Up @@ -44,8 +40,9 @@ For example:
* ALIAS: johns@BAR.COM jsmith
</pre>
If the user (as passed to the plugin) is an exact match for the first string, the plugin will return the given username.

---++ How it works
When it runs, the plugin performs the following steps in succession to the username passed to initializeUserHandler. $Foswiki::securityFilter is applied to all results before they are returned. Note that if $ENV{'REMOTE_ADDR'} is not set, the plugin will return "" after logging some debugging information (if DEBUG is set).
When it runs, the plugin performs the following steps in succession to the username passed to initializeUserHandler. $Foswiki::securityFilter is applied to all results before they are returned.

1. If the username is blank or would be blank after applying $Foswiki::securityFilter, return either "", or the value of MAP_BLANK_USER if it is set. *Note:* a username that would evaluate to false in Perl (e.g. the user "0") is treated as blank.
2. If USE_ALIASES is set, the alias list is checked for a match and the first match found is returned.
Expand Down Expand Up @@ -80,6 +77,9 @@ Sample alias (disabled by a # character):

</verbatim>

The currently logged in user's =%!USERINFO%= is
* %USERINFO%


* Set ALLOWTOPICCHANGE = %MAINWEB%.AdminGroup

Expand Down
11 changes: 1 addition & 10 deletions lib/Foswiki/Plugins/LoginNameAliasesPlugin.pm
Expand Up @@ -98,16 +98,7 @@ sub initializeUserHandler

# my $sec_filter = $Foswiki::securityFilter;

# Assume Foswiki is being called from a script (mailnotify, etc)
# if REMOTE_ADDR is not set. In that case, log a debug message
# and exit.

unless ($ENV{'REMOTE_ADDR'}) {
Foswiki::Func::writeDebug( "- $pluginName REMOTE_ADDR not set. Returning." )
if ($Foswiki::cfg{LoginNameAliasesPlugin}{'DEBUG'});
return "";
}


Foswiki::Func::writeDebug( "- $pluginName prefs read. user: $original_loginName" )
if ($Foswiki::cfg{LoginNameAliasesPlugin}{'DEBUG'});

Expand Down

0 comments on commit 88d780a

Please sign in to comment.