Vaskovsky Web Application  3.17.0306
Public Member Functions | List of all members
AVaskovsky\WebApplication\BasicAuthentication Class Reference

Performs basic HTTP authentication. More...

Inheritance diagram for AVaskovsky\WebApplication\BasicAuthentication:
Inheritance graph
Collaboration diagram for AVaskovsky\WebApplication\BasicAuthentication:
Collaboration graph

Public Member Functions

 __construct ($realm,\PDO $pdo, $table)
 Creates a new instance. More...
 getAccountAttribute ($name)
 Returns an account attribute. More...
 getPasswordHash ($password)
 Creates a new password hash. More...
 signOut ()
 Signs out. More...
 authenticate ()
 Performs authentication. More...

Detailed Description

Performs basic HTTP authentication.

Alexey Vaskovsky

Definition at line 23 of file BasicAuthentication.php.

Constructor & Destructor Documentation

AVaskovsky\WebApplication\BasicAuthentication::__construct (   $realm,
\PDO  $pdo,

Creates a new instance.

string$realmis a realm string for the HTTP Authentication.
PDO$pdois a PDO connection.
string$tableis a table name where user data is stored.
InvalidArgumentException: if $pdo is null; if $table is empty.

Definition at line 41 of file BasicAuthentication.php.

Member Function Documentation

AVaskovsky\WebApplication\BasicAuthentication::authenticate ( )

Performs authentication.

true if user is authenticated; false otherwise.

Implements AVaskovsky\WebApplication\AbstractAuthentication.

Definition at line 112 of file BasicAuthentication.php.

AVaskovsky\WebApplication\BasicAuthentication::getAccountAttribute (   $name)

Returns an account attribute.

This method performs authentication if user is not authenticated yet, loads account attributes and returns a value of the specified attribute.

string$nameis an attribute name.
InvalidArgumentExceptionif $name is empty.
the attribute value or null if the authentication failed.

Implements AVaskovsky\WebApplication\AbstractAuthentication.

Definition at line 68 of file BasicAuthentication.php.

AVaskovsky\WebApplication\BasicAuthentication::getPasswordHash (   $password)

Creates a new password hash.

string$passwordis a password string.
InvalidArgumentExceptionif $password is null.
a string that contains the password hash; never null.

Implements AVaskovsky\WebApplication\AbstractAuthentication.

Definition at line 83 of file BasicAuthentication.php.

AVaskovsky\WebApplication\BasicAuthentication::signOut ( )

Signs out.

See also

Implements AVaskovsky\WebApplication\AbstractAuthentication.

Definition at line 97 of file BasicAuthentication.php.

The documentation for this class was generated from the following file: