LiveUser
[ class tree: LiveUser ] [ index: LiveUser ] [ all elements ]

Class: LiveUser_Auth_Common

Source Location: /LiveUser-0.16.14/LiveUser/Auth/Common.php

Class Overview


This class provides a set of functions for implementing a user authorisation system on live websites. All authorisation backends/containers must be inherited from this base class.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2002-2006 Markus Wolff

Variables

Methods


Child classes:

LiveUser_Auth_XML
XML driver for authentication
LiveUser_Auth_PDO
PDO container for Authentication. This is a PHP5 only driver.
LiveUser_Auth_MDB2
MDB2 container for Authentication
LiveUser_Auth_Session
Session based container for Authentication
LiveUser_Auth_MDB
MDB container for Authentication
LiveUser_Auth_DB
DB container for Authentication
LiveUser_Auth_PEARAuth
PEAR_Auth container for Authentication

Inherited Variables

Inherited Methods


Class Details

[line 60]
This class provides a set of functions for implementing a user authorisation system on live websites. All authorisation backends/containers must be inherited from this base class.


[ Top ]


Class Variables

$alias = array()

[line 193]

All fields with their alias
  • Access: public

Type:   array


[ Top ]

$containerName =  null

[line 153]

The name associated with this auth container. The name is used when adding users from this container to the reference table in the permission container. This way it is possible to see from which auth container the user data is coming from.
  • Access: public

Type:   string


[ Top ]

$currentLogin =  0

[line 77]

Timestamp of current login (last to be written)
  • Access: public

Type:   int


[ Top ]

$encryptionModes = array(
        'MD5'   => 'MD5',
        'PLAIN' => 'PLAIN',
        'RC4'   => 'RC4',
        'SHA1'  => 'SHA1'
    )

[line 106]

Possible encryption modes.
  • Access: public

Type:   array


[ Top ]

$expireTime =  0

[line 87]

Auth maximum lifetime in seconds

If this variable is set to 0, auth never expires

  • Access: public

Type:   int


[ Top ]

$externalValues = array()

[line 161]

External values to check (config settings)
  • Access: public

Type:   array


[ Top ]

$fields = array()

[line 185]

All fields with their types
  • Access: public

Type:   array


[ Top ]

$handles = array('handle')

[line 169]

A list of handle fields that are used to find a user.
  • Access: public

Type:   array


[ Top ]

$idleTime =  0

[line 98]

Maximum time of idleness in seconds

Idletime gets refreshed each time, init() is called. If this variable is set to 0, idle time is never checked.

  • Access: public

Type:   int


[ Top ]

$loggedIn =  null

[line 69]

Has the current user successfully logged in?
  • See: LiveUser_Auth_Common::isActive
  • Access: public

Type:   bool


[ Top ]

$passwordEncryptionMode =  'MD5'

[line 118]

Defines the algorithm used for encrypting/decrypting passwords.

Type:   string


[ Top ]

$propertyValues = array()

[line 142]

Array of all the user data read from the backend database
  • Access: public

Type:   array


[ Top ]

$secret =  ''

[line 126]

Defines the secret to use for encryption if needed
  • Access: public

Type:   string


[ Top ]

$stack =  null

[line 134]

Error stack
  • Access: public

Type:   PEAR_ErrorStack


[ Top ]

$tables = array()

[line 177]

Table configuration
  • Access: public

Type:   array


[ Top ]



Method Detail

LiveUser_Auth_Common (Constructor)   [line 203]

void LiveUser_Auth_Common( )

Class constructor. Feel free to override in backend subclasses.
  • Var: configuration options
  • Access: protected

[ Top ]

decryptPW   [line 304]

string decryptPW( string $encryptedPW)

Decrypts a password so that it can be compared with the user input.

Uses the algorithm defined in the passwordEncryptionMode property.

  • Return: the decrypted password
  • Access: public

Parameters:

string   $encryptedPW   —  the encrypted password

[ Top ]

disconnect   [line 483]

bool disconnect( )

properly disconnect from resources
  • Return: true on success or false on failure
  • Access: public

Overridden in child classes as:

LiveUser_Auth_XML::disconnect()
Properly disconnect from resources
LiveUser_Auth_PDO::disconnect()
properly disconnect from database
LiveUser_Auth_MDB2::disconnect()
properly disconnect from database
LiveUser_Auth_MDB::disconnect()
Properly disconnect from database
LiveUser_Auth_DB::disconnect()
Properly disconnect from database

[ Top ]

encryptPW   [line 318]

string encryptPW( string $plainPW)

Encrypts a password for storage in a backend container.

Uses the algorithm defined in the passwordEncryptionMode property.

  • Return: the encrypted password
  • Access: public

Parameters:

string   $plainPW   —  encryption type

[ Top ]

externalValuesMatch   [line 459]

bool externalValuesMatch( )

Check if the stored external values match the current external values
  • Return: true on success or false on failure
  • Access: public

[ Top ]

freeze   [line 263]

array freeze( )

store all properties in an array
  • Access: public

[ Top ]

getProperty   [line 420]

mixed getProperty( string $what)

Function returns the inquired value if it exists in the class.
  • Return: null, a scalar or an array.
  • Access: public

Parameters:

string   $what   —  name of the property to be returned.

[ Top ]

init   [line 217]

bool init( array $conf, string $containerName)

Load the storage container
  • Return: true on success or false on failure
  • Access: public

Overridden in child classes as:

LiveUser_Auth_XML::init()
Load the storage container
LiveUser_Auth_PDO::init()
Load the storage container
LiveUser_Auth_MDB2::init()
Load the storage container
LiveUser_Auth_Session::init()
Load the storage container
LiveUser_Auth_MDB::init()
Load the storage container
LiveUser_Auth_DB::init()
Load the storage container
LiveUser_Auth_PEARAuth::init()
Load the storage container

Parameters:

array   $conf   —  array containing the configuration.
string   $containerName   —  name of the container that should be used

[ Top ]

login   [line 334]

bool login( string $handle, string $passwd, [bool|int $auth_user_id = false])

Tries to make a login with the given handle and password.

A user can't login if he's not active.

  • Return: null when user is inactive, true on success or false on failure
  • Access: public

Parameters:

string   $handle   —  user handle
string   $passwd   —  user password
bool|int   $auth_user_id   —  if the user data should be read using the auth user id

[ Top ]

readUserData   [line 404]

bool readUserData( [string $handle = ''], [string $passwd = ''], [bool|int $auth_user_id = false])

Reads user data from the given data source If only $handle is given, it will read the data from the first user with that handle and return true on success.

If $handle and $passwd are given, it will try to find the first user with both handle and password matching and return true on success (this allows multiple users having the same handle but different passwords - yep, some people want this). if only an auth_user_id is passed it will try to read the data based on the id If no match is found, false is being returned.

Again, this does nothing in the base class. The described functionality must be implemented in a subclass overriding this method.

  • Return: true on success or false on failure
  • Access: public

Overridden in child classes as:

LiveUser_Auth_XML::readUserData()
Reads user data from the given data source If only $handle is given, it will read the data from the first user with that handle and return true on success.
LiveUser_Auth_PDO::readUserData()
Reads user data from the given data source If only $handle is given, it will read the data from the first user with that handle and return true on success.
LiveUser_Auth_MDB2::readUserData()
Reads user data from the given data source If only $handle is given, it will read the data from the first user with that handle and return true on success.
LiveUser_Auth_Session::readUserData()
Reads user data from the given data source Compares $passwd with a string inside the $_SESSION array
LiveUser_Auth_MDB::readUserData()
Reads user data from the given data source If only $handle is given, it will read the data from the first user with that handle and return true on success.
LiveUser_Auth_DB::readUserData()
Reads user data from the given data source If only $handle is given, it will read the data from the first user with that handle and return true on success.
LiveUser_Auth_PEARAuth::readUserData()
Reads user data from the given data source Starts and verifies the PEAR::Auth login process

Parameters:

string   $handle   —  user handle
string   $passwd   —  user password
bool|int   $auth_user_id   —  if the user data should be read using the auth user id

[ Top ]

setExternalValues   [line 438]

void setExternalValues( )

Creates associative array of values from $externalValues['values'] with $keysToCheck
  • Access: public

[ Top ]

unfreeze   [line 286]

bool unfreeze( array $propertyValues)

Reinitializes properties
  • Access: public

Parameters:

array   $propertyValues   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:40:12 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.