create new tag
, view all tags
ALERT! NOTE: This is a DistributionDocument. This document is generated, please do not change it. Put questions, error notes, and suggestions concerning the documentation of this topic in the comments section below. Use the Support web for problems you are having using TWiki.

Package TWiki::Client

The package is also a Factory for login managers and also the base class for all login managers.

On it's own, an object of this class is used when you specify 'none' in the security setup section of configure. When it is used, logins are not supported. If you want to authenticate users then you should consider TemplateLogin or ApacheLogin, which are subclasses of this class.

If you are building a new login manager, then you should write a new subclass of this class, implementing the methods marked as VIRTUAL. There are already examples in the lib/TWiki/Client directory.

StaticMethod makeClient ($twiki) -> $TWiki::Client

Factory method, used to generate a new TWiki::Client object for the given session.

ObjectMethod loadSession ()

Get the client session data, using the cookie and/or the request URL. Set up appropriate session variables in the twiki object and return the login name.

ObjectMethod checkAccess ()

Check if the script being run in this session is authorised for execution. If not, throw an access control exception.

ObjectMethod finish

Complete processing after the client's HTTP request has been responded to. Flush the user's session (if any) to disk.

StaticMethod expireDeadSessions ()

Delete sessions that are sitting around but are really expired. This assumes that the sessions are stored as files.

This is a static method, but requires TWiki::cfg. It is designed to be run from a session or from a cron job.

ObjectMethod userLoggedIn ($login,$wikiname)

Called when the user logs in. It's invoked from TWiki::UI::Register::finish for instance, when the user follows the link in their verification email message.

  • $login - string login name
  • $wikiname - string wikiname

ObjectMethod endRenderingHandler ()

This handler is called by getRenderedVersion just before the plugins postRenderingHandler. So it is passed all HTML text just before it is printed.

DEPRECATED Use postRenderingHandler instead.

ObjectMethod addCookie ($c)

Add a cookie to the list of cookies for this session.

  • $c - a CGI::Cookie

ObjectMethod modifyHeader (\%header)

Modify a HTTP header
  • \%header - header entries

ObjectMethod redirectCgiQuery ($url)

Generate an HTTP redirect on STDOUT, if you can. Return 1 if you did. Don't forget to pass all query parameters through.
  • $url - target of the redirection.

ObjectMethod getSessionValues () -> \%values

Get a name->value hash of all the defined session variables

ObjectMethod getSessionValue ($name) -> $value

Get the value of a session variable.

ObjectMethod setSessionValue ($name,$value)

Set the value of a session variable. We do not allow setting of AUTHUSER.

ObjectMethod clearSessionValue ($name)

Clear the value of a session variable. We do not allow setting of AUTHUSER.

ObjectMethod forceAuthentication () -> boolean

VIRTUAL METHOD implemented by subclasses

Triggered by an access control violation, this method tests to see if the current session is authenticated or not. If not, it does whatever is needed so that the user can log in, and returns 1.

If the user has an existing authenticated session, the function simply drops though and returns 0.

ObjectMethod loginUrl (...) -> $url

VIRTUAL METHOD implemented by subclasses

Return a full URL suitable for logging in.

  • ... - url parameters to be added to the URL, in the format required by TWiki::getScriptUrl()

ObjectMethod getUser ()

VIRTUAL METHOD implemented by subclasses

If there is some other means of getting a username - for example, Apache has remote_user() - then return it. Otherwise, return undef and the username stored in the session will be used.

Comments & Questions about this Distribution Document Topic

Please use the Support forum if you have questions about TWiki features. This comment section is about the documentation of this topic.
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2006-05-01 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.