Class jAuth

Description

This is the main class for authentification process

Located in /auth/jAuth.class.php (line 27)


	
			
Variable Summary
static mixed $config
static mixed $driver
Method Summary
static boolean changePassword (string $login, string $newpassword)
static void checkCookieToken ()
static object the createUserObject (string $login, string $password)
static void generateCookieToken ( $login,  $password)
static string getDriverParam (string $paramName)
static string getRandomPassword ([int $length = 10])
static object the getUser (string $login)
static array getUserList ([string $pattern = '%'])
static object the getUserSession ()
static boolean isConnected ()
static boolean isPersistant ()
static array loadConfig ([ $newconfig = null])
static boolean login (string $login, string $password, [boolean $persistant = false])
static void logout ()
static boolean removeUser (string $login)
static object the saveNewUser (object $user)
static void updateUser (object $user)
static object|false verifyPassword (string $login, string $password)
static void _getConfig ()
static void _getDriver ()
Variables
static mixed $config = null (line 37)
  • access: protected
static mixed $driver = null (line 38)
  • access: protected
Methods
static changePassword (line 283)

change a user password

  • return: true if the change succeed
  • access: public
static boolean changePassword (string $login, string $newpassword)
  • string $login: the login of the user
  • string $newpassword: the new password (not encrypted)
static checkCookieToken (line 418)
  • access: public
static void checkCookieToken ()
static createUserObject (line 183)

Create a new user object

You should call this method if you want to create a new user. It returns an object, representing a user. Then you should fill its properties and give it to the saveNewUser method.

  • return: returned object depends on the driver
  • since: 1.0b2
  • access: public
static object the createUserObject (string $login, string $password)
  • string $login: the user login
  • string $password: the user password (not encrypted)
static generateCookieToken (line 443)
  • access: public
static void generateCookieToken ( $login,  $password)
  • $login
  • $password
static getDriver (line 123)

return the auth driver

  • since: 1.2.10
  • access: public
static jIAuthDriver getDriver ()
static getDriverParam (line 147)

return the value of a parameter of the configuration of the current driver

  • return: the value. null if it doesn't exist
  • access: public
static string getDriverParam (string $paramName)
  • string $paramName
static getRandomPassword (line 407)

generate a password with random letter or number

  • return: the generated password
  • access: public
static string getRandomPassword ([int $length = 10])
  • int $length: the length of the generated password
static getUser (line 166)

load user data

This method returns an object, generated by the driver, and which contains data corresponding to the given login. This method should be called if you want to update data of a user. see updateUser method.

  • return: user
  • access: public
static object the getUser (string $login)
  • string $login
static getUserList (line 271)

construct the user list

  • return: array of object
  • access: public
static array getUserList ([string $pattern = '%'])
  • string $pattern: '' for all users
static getUserSession (line 395)

return the user stored in the php session

  • return: user data
  • access: public
static object the getUserSession ()
static isConnected (line 386)

Says if the user is connected

  • access: public
static boolean isConnected ()
static isPersistant (line 352)

Check if persistant session is enabled in config

  • return: true if persistant session in enabled
  • access: public
static boolean isPersistant ()
static loadConfig (line 44)

Load the configuration of authentification, stored in the auth plugin config

  • since: 1.2.10
  • access: public
static array loadConfig ([ $newconfig = null])
  • $newconfig
static login (line 312)

authentificate a user, and create a user in the php session

  • return: true if authentification is ok
  • access: public
static boolean login (string $login, string $password, [boolean $persistant = false])
  • string $login: the login of the user
  • string $password: the password to test (not encrypted)
  • boolean $persistant: (optional) the session must be persistant
static logout (line 363)

logout a user and delete the user in the php session

  • access: public
static void logout ()
static removeUser (line 250)

remove a user send first AuthCanRemoveUser event, then if ok, send AuthRemoveUser and then remove the user.

  • return: true if ok
  • access: public
static boolean removeUser (string $login)
  • string $login: the user login
static saveNewUser (line 205)

Save a new user

if the saving has succeed, a AuthNewUser event is sent The given object should have been created by calling createUserObject method :

example :

   $user = jAuth::createUserObject('login','password');
   $user->email ='bla@foo.com';
   jAuth::saveNewUser($user);
the type of $user depends of the driver, so it can have other properties.

  • return: user (eventually, with additional data)
  • access: public
static object the saveNewUser (object $user)
  • object $user: the user data
static updateUser (line 230)

update user data

It send a AuthUpdateUser event if the saving has succeed. If you want to change the user password, you must use jAuth::changePassword method instead of jAuth::updateUser method.

The given object should have been created by calling getUser method. Example :

   $user = jAuth::getUser('login');
   $user->email ='bla@foo.com';
   jAuth::updateUser($user);
the type of $user depends of the driver, so it can have other properties.

  • access: public
static void updateUser (object $user)
  • object $user: user data
static verifyPassword (line 300)

verify that the password correspond to the login

  • return: if ok, returns the user as object
  • access: public
static object|false verifyPassword (string $login, string $password)
  • string $login: the login of the user
  • string $password: the password to test (not encrypted)
static _getConfig (line 33)
  • see: jAuth::getConfig()
  • deprecated:
  • access: protected
static void _getConfig ()
static _getDriver (line 114)
static void _getDriver ()

Documentation generated on Thu, 19 Sep 2013 00:02:21 +0200 by phpDocumentor 1.4.3