Class jAuth

Description

This is the main class for authentification process

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


	
			
Variable Summary
static mixed $config
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], [boolean $withoutSpecialChars = false])
static object the getUser (string $login)
static array getUserList ([string $pattern = '%'])
static object the getUserSession ()
static boolean isConnected ()
static boolean isPersistant ()
static array loadConfig ([null $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 boolean updateUser (object $user)
static object|false verifyPassword (string $login, string $password)
static void _getConfig ()
static void _getDriver ()
Variables
static mixed $config = null (line 34)
  • access: protected
static jIAuthDriver $driver = null (line 39)
  • access: protected
Methods
static changePassword (line 295)

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 466)
  • access: public
static void checkCookieToken ()
static createUserObject (line 194)

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 492)
  • access: public
static void generateCookieToken ( $login,  $password)
  • $login
  • $password
static getDriver (line 141)

return the auth driver

  • since: 1.2.10
  • throws: jException
  • access: public
static jIAuthDriver getDriver ()
static getDriverParam (line 158)

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 425)

generate a password with random letters, numbers and special characters

  • return: the generated password
  • access: public
static string getRandomPassword ([int $length = 10], [boolean $withoutSpecialChars = false])
  • int $length: the length of the generated password
  • boolean $withoutSpecialChars: (optional, default false) the generated password may be use this characters : !@#$%^&*?_,~
static getUser (line 177)

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 283)

construct the user list

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

return the user stored in the php session

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

Says if the user is connected

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

Check if persistant session is enabled in config

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

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

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

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 375)

logout a user and delete the user in the php session

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

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 216)

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 242)

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.

  • return: true if the user has been updated
  • access: public
static boolean updateUser (object $user)
  • object $user: user data
static verifyPassword (line 312)

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 30)
  • see: jAuth::getConfig()
  • deprecated:
  • access: protected
static void _getConfig ()
static _getDriver (line 131)
static void _getDriver ()

Documentation generated on Tue, 14 Feb 2017 15:17:16 +0100 by phpDocumentor 1.4.3