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
[legend]
Collaboration diagram for AVaskovsky\WebApplication\BasicAuthentication:
Collaboration graph
[legend]

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.

Author
Alexey Vaskovsky

Definition at line 23 of file BasicAuthentication.php.

Constructor & Destructor Documentation

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

Creates a new instance.

Parameters
string$realmis a realm string for the HTTP Authentication.
PDO$pdois a PDO connection.
string$tableis a table name where user data is stored.
Exceptions
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.

Returns
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.

Parameters
string$nameis an attribute name.
Exceptions
InvalidArgumentExceptionif $name is empty.
Returns
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.

Parameters
string$passwordis a password string.
Exceptions
InvalidArgumentExceptionif $password is null.
Returns
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
authenticate()

Implements AVaskovsky\WebApplication\AbstractAuthentication.

Definition at line 97 of file BasicAuthentication.php.


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