internal package Foswiki::Plugins::ModifyLoginPlugin

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

internal package ModifyLoginPlugin

This is a simple plugin that can convert the login provided by the user to a the format needed by Foswiki server to identify the user.

It is typically used when you have a single sign on scheme like mod_ldap where the login name can be authenticated in more than one way. Typically ldap servers will authenticate users without paying attention to case.

This means that the same user can be authenticated as ABC123 and abc123

Foswiki however is case sensitive. This means that users that sometimes use uppercase and sometimes lowercase login will often not be recognized by Foswiki but appear with their raw login name and maybe be denied access.

Using this plugin you can set Foswiki::cfg{Plugins}{ModifyLoginPlugin}{ChangeCase} to 'lower' and the user will always have his login name converted to lowercase.

Foswiki will then always see the user as his lowercase login.

The plugin has one additional independent feature. It can assign a login name based on a specific path. This is used to open a controlled backdoor to Foswiki via a specific list of topics. This enables creating a special user with a carefully assigned set of access rights. A typical use is to create a query page that can lookup information within a web without authentication.

A plugin may be implemented to look directly at the ENV and use the REMOTE_USER directly. This plugin cannot deal with that. But most plugin should behave correctly.

initPlugin($topic, $web, $user) → $boolean

  • $topic - the name of the topic in the current CGI query
  • $web - the name of the web in the current CGI query
  • $user - the login name of the user
  • $installWeb - the name of the web the plugin topic is in (usually the same as $Foswiki::cfg{SystemWebName})

REQUIRED

Called to initialise the plugin. If everything is OK, should return a non-zero value. On non-fatal failure, should write a message using Foswiki::Func::writeWarning and return 0. In this case %FAILEDPLUGINS% will indicate which plugins failed.

In the case of a catastrophic failure that will prevent the whole installation from working safely, this handler may use 'die', which will be trapped and reported in the browser.

Note: Please align macro names with the Plugin name, e.g. if your Plugin is called FooBarPlugin, name macros FOOBAR and/or FOOBARSOMETHING. This avoids namespace issues.

initializeUserHandler( $loginName, $url, $pathInfo )

  • $loginName - login name recovered from $ENV{REMOTE_USER}
  • $url - request url
  • $pathInfo - pathinfo from the CGI query
Allows a plugin to set the username. Normally Foswiki gets the username from the login manager. This handler gives you a chance to override the login manager.

Return the login name.

This handler is called very early, immediately after earlyInitPlugin.

Since: Foswiki::Plugins::VERSION = '2.0'

Topic revision: r1 - 21 Nov 2014, ProjectContributor - This page was cached on 26 May 2023 - 22:58.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Irish Doughnut Economics Network? Send feedback