ez.no / exponential / documentation / configuration / configuration / login 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
Log in or create a user account to comment.
Comments
Placing a login handler inside an extension
Kristof Coomans
Friday 25 November 2005 1:26:43 pm
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:
Replace yourextensionname with the name of your extension.