PHP Class AuthComponent, miniPHP

Authenticate & Authorize the current user.
Author: Omar El Gabry ([email protected])
Inheritance: extends Component
Show file Open project: omarelgabry/miniphp Class Usage Examples

Protected Properties

Property Type Description
$config array Default configurations

Public Methods

Method Description
authenticate ( ) : boolean authenticate the user using the defined methods in $config
authorize ( ) : boolean authorize the user using the defined methods in $config
isLoggedIn ( ) : boolean Is user is already logged in via session or cookie?
startup ( ) Auth startup All authentication and authorization checking are done in this method
unauthenticated ( ) Handles unauthenticated access attempt.
unauthorized ( ) Handles unauthorized access attempt.

Private Methods

Method Description
_ControllerAuthorize ( array $config ) : boolean Is user authorized for the requested Controller & Action method?
_UserAuthenticate ( array $config ) : boolean Is user authenticated? It checks for: - concurrent session - user credentials in session & cookies - cookies theft and manipulations - session Hijacking and fixation.
check ( array $config, string $type ) : boolean check for authentication or authorization
concurentSession ( )
loggedIn ( ) : boolean Checks if user is logged in or not.

Method Details

authenticate() public method

authenticate the user using the defined methods in $config
public authenticate ( ) : boolean
return boolean

authorize() public method

authorize the user using the defined methods in $config
public authorize ( ) : boolean
return boolean

isLoggedIn() public method

Is user is already logged in via session or cookie?
public isLoggedIn ( ) : boolean
return boolean

startup() public method

Auth startup All authentication and authorization checking are done in this method
public startup ( )

unauthenticated() public method

Handles unauthenticated access attempt.
public unauthenticated ( )

unauthorized() public method

Handles unauthorized access attempt.
public unauthorized ( )

Property Details

$config protected property

Default configurations
protected array $config
return array