WiseLoop PHP REST Services 3.3.1
RESTful web service API framework for PHP
wlAuthHandlerPdo Class Reference
Inheritance diagram for wlAuthHandlerPdo:

Public Member Functions

 __construct ($connString, $dbUserName, $dbPassword, $usersTable= 'users', $userNameField= 'userName', $passwordField= 'password', $isPasswordMd5=true)
 isAuthorized ($request)
 authenticate ($authData)

Private Attributes

 $_connString
 $_dbUserName
 $_dbPassword
 $_usersTable
 $_userNameField
 $_passwordField
 $_isPasswordMd5

Detailed Description

WiseLoop AuthHandlerPdo class definition
This class is designed to provide security handlers that are authorizing users stored in a database.
The connection to the database is made through PDO extension, so make sure you have it enabled.

Author:
WiseLoop
See also:
wlAuthHandler

See also: Authentication & Authorization


Constructor & Destructor Documentation

__construct ( connString,
dbUserName,
dbPassword,
usersTable = 'users',
userNameField = 'userName',
passwordField = 'password',
isPasswordMd5 = true 
)
Parameters:
string$connStringthe PDO connection string
string$dbUserNamethe database user name used to connect
string$dbPasswordthe database password
string$usersTablethe table name that stores the users
string$userNameFieldthe field name that corresponds to the userName used in authentication mechanism
string$passwordFieldthe field name that corresponds to the user password
bool$isPasswordMd5specifies if the password id hashed using md5

Member Function Documentation

authenticate ( authData)

This method authenticates a user/password pair against the database.

Parameters:
array$authDataan array containing two fields: userName and password
Exceptions:
Exception
Returns:
array the user information consisting of all the fields for the authenticated user except the password (ex. fullName, access rights, email etc.)

Reimplemented from wlAuthHandler.

isAuthorized ( request)

This method should be overwritten in the derived classes and describes how to authorize a request.

Parameters:
wlRestRequest$requestthe current request
Returns:
bool

Reimplemented from wlAuthHandler.


Field Documentation

$_connString [private]

Type: string the PDO connection string

$_dbPassword [private]

Type: string the database password

$_dbUserName [private]

Type: string the database user name used to connect

$_isPasswordMd5 [private]

Type: bool specifies if the password id hashed using md5

$_passwordField [private]

Type: string the field name that corresponds to the user password

$_userNameField [private]

Type: string the field name that corresponds to the userName used in authentication mechanism

$_usersTable [private]

Type: string the table name that stores the users

 All Data Structures Functions Variables