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

Class: LiveUser_Auth_Common

Source Location: /LiveUser-0.16.5/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 extensions of this base class.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2002-2005 Markus Wolff

Variables

Methods


Child classes:

LiveUser_Auth_XML
XML driver for authentication
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 66]
This class provides a set of functions for implementing a user authorisation system on live websites. All authorisation backends/containers must be extensions of this base class.

Requirements:

  • When using "DB" backend: PEAR::DB database abstraction layer
  • LiveUser admin GUI for easy user administration and setup of authorisation areas and rights



[ Top ]


Class Variables

$alias = array()

[line 220]

  • Access: public

Type:   array


[ Top ]

$allowDuplicateHandles =  false

[line 125]

Allow multiple users in the database to have the same login handle. Default: false.

Type:   boolean


[ Top ]

$allowEmptyPasswords =  false

[line 132]

Allow empty passwords to be passed to LiveUser. Default: false.

Type:   boolean


[ Top ]

$backendArrayIndex =  0

[line 164]

Defines the array index number of the LoginManager?s "backends" property.

Type:   integer


[ Top ]

$containerName =  null

[line 191]

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 82]

Timestamp of current login (last to be written)

Type:   integer


[ Top ]

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

[line 139]

Set posible encryption modes.

Type:   array


[ Top ]

$expireTime =  0

[line 107]

Auth lifetime in seconds

If this variable is set to 0, auth never expires


Type:   integer


[ Top ]

$externalValues = array()

[line 199]

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

Type:   array


[ Top ]

$fields = array()

[line 213]

  • Access: public

Type:   array


[ Top ]

$idleTime =  0

[line 117]

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.


Type:   integer


[ Top ]

$loggedIn =  null

[line 75]

Has the current user successfully logged in? Default: false
  • See: LiveUser_Auth_Common::isActive

Type:   boolean


[ Top ]

$loginTimeout =  12

[line 98]

Number of hours that must pass between two logins to be counted as a new login. Comes in handy in some situations. Default: 12

Type:   integer


[ Top ]

$passwordEncryptionMode =  'MD5'

[line 150]

Defines the algorithm used for encrypting/decrypting passwords. Default: "MD5".

Type:   string


[ Top ]

$propertyValues = array()

[line 180]

Property values
  • Access: public

Type:   array


[ Top ]

$secret =

[line 157]

Defines the secret to use for encryption if needed

Type:   string


[ Top ]

$tables = array()

[line 206]

  • Access: public

Type:   array


[ Top ]

$updateLastLogin =  true

[line 89]

Update the last login time or not

Type:   boolean


[ Top ]



Method Detail

LiveUser_Auth_Common (Constructor)   [line 230]

void LiveUser_Auth_Common( )

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

[ Top ]

decryptPW   [line 332]

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 574]

void disconnect( )

properly disconnect from resources
  • Access: public

Overridden in child classes as:

LiveUser_Auth_XML::disconnect()
Properly disconnect from resources
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 366]

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 550]

boolean externalValuesMatch( )

Check if the stored external values match the current external values
  • Access: public

[ Top ]

freeze   [line 290]

array freeze( )

store all properties in an array
  • Access: public

[ Top ]

getProperty   [line 511]

mixed getProperty( string $what)

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

Parameters:

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

[ Top ]

init   [line 244]

boolean init( $conf, string $containerName, mixed &$conf)

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_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:

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

[ Top ]

isNewLogin   [line 401]

boolean isNewLogin( )

Checks if there's enough time between lastLogin and current login (now) to count as a new login.
  • Return: true if it is a new login, false if not
  • Access: public

[ Top ]

login   [line 424]

boolean login( string $handle, string $passwd)

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

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

  • Access: public

Parameters:

string   $handle   —  user handle
string   $passwd   —  user password

[ Top ]

readUserData   [line 495]

void readUserData( [string $handle = ''], [boolean $passwd = ''], [string $auth_user_id = false])

Reads auth_user_id, passwd, is_active flag

lastlogin timestamp from the database 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 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.

  • Access: public

Overridden in child classes as:

LiveUser_Auth_DB::readUserData()
Reads auth_user_id, passwd, is_active flag

Parameters:

string   $handle   —  user handle
boolean   $passwd   —  user password
string   $auth_user_id   —  auth user id

[ Top ]

setExternalValues   [line 529]

void setExternalValues( )

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

[ Top ]

unfreeze   [line 313]

boolean unfreeze( array $propertyValues)

Reinitializes properties

Parameters:

array   $propertyValues   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:16:41 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.