Path

ez.no / exponential / documentation / configuration / configuration / login handler / how to make your own handler


How to make your own handler

Step 1: Create the necessary file for your new handler.

Suppose you are going to make a login handler called 'MyLoginHandler". The one file you need to create should be ezmyloginhandleruser.php and it should be put under ./kernel/classes/datatypes/ezuser/. The rule is that if you added a handler x, it should be stored as: ./kernel/classes/datatypes/ezuser/ezxuser.php. Here is the standard structure of this file:

<?php

include_once( "kernel/classes/datatypes/ezuser/ezusersetting.php" );

include_once( "kernel/classes/datatypes/ezuser/ezuser.php" );

include_once( 'lib/ezutils/classes/ezini.php' );

 

class eZMyLoginHandlerUser extends eZUser

{

  /*!

   Constructor

  */

  function eZMyLoginHandlerUser()

  {

  }

 

  /*!

  \static

  */

  function &loginUser( $login, $password, $authenticationMatch = false )

  {

      // Your implementation of the handler. If login allowed, 

      // create the user and return $user object, return false if login not 

      // allowed.

      return $user;

  }

}

 

?>

Note that this class should extends eZUser and override function loginUser() for class eZUser.

In addition, you can create configuration file settings/myloginhandler.ini, which defines setting for your handler ( user placement, attribute match between Exponential and external server, etc. ). When implement function loginUser(), you can then reading settings from this file.

Step 2: Update settings/site.ini to include the handler.

Open Exponential configuration file settings/site.ini, find line

LoginHandler[]=standard

under [UserSettings] block.

Add 'LoginHandler[]=MyLoginHandler' under this line:

LoginHandler[]=standard

LoginHandler[]=MyLoginHandler

 

Comments

Placing a login handler inside an extension

Since Exponential 3.6 you can place your login handler inside an extension, instead of moving it to the kernel.

Create a directory called login_handler in your extension, put the login handler class in this directory, and place the following settings in site.ini.append in your extension's settings directory:
[UserSettings]


# Exponential 3.6 < 3.6.2


ExtensionDirectories[]=yourextensionname


# Exponential >= 3.6.2


ExtensionDirectory[]=yourextensionname

Replace yourextensionname with the name of your extension.

Log in or create a user account to comment.

Contents

Configuration

Configuration
    WebDAV setup
    Exponential running on a CGI version o...
    Path prefix
    Locale Settings
    Introduction
    Configuration files
    Site access
    Common settings
    Multi Site
    Directory structure
    Language and charset
    Cron jobs
    Login handler
       Using LDAP server
       Using text file
       How to make your own handler
    Search engine
    Tips & Tricks
Security
Optimization
Backup & Restore
Troubleshooting


Created

04/08/2003
12:18:13 pm
by Wenyue Yu

Last updated

04/08/2003
4:53:09 pm
by Wenyue Yu

Authors

Wenyue Yu



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.