PHP Class Kohana_Auth, php-framework-benchmarks

Author: Kohana Team
Show file Open project: pmjones/php-framework-benchmarks Class Usage Examples

Protected Properties

Property Type Description
$_config
$_instance Auth instances
$_session

Public Methods

Method Description
__construct ( $config = [] ) : void Loads Session and configuration options.
check_password ( $password )
factory ( $config = [] ) : Auth Create an instance of Auth.
find_salt ( $password ) : string Finds the salt from a password, based on the configured salt pattern.
get_user ( ) : mixed Gets the currently logged in user from the session.
hash ( $str ) : string Perform a hash, using the configured method.
hash_password ( $password, $salt = FALSE ) : string Creates a hashed password from a plaintext password, inserting salt based on the configured salt pattern.
instance ( ) : Auth Singleton pattern
logged_in ( $role = NULL ) : mixed Check if there is an active session. Optionally allows checking for a specific role.
login ( $username, $password, $remember = FALSE ) : boolean Attempt to log in a user by using an ORM object and plain-text password.
logout ( $destroy = FALSE, $logout_all = FALSE ) : boolean Log out a user by removing the related session variables.
password ( $username )

Protected Methods

Method Description
_login ( $username, $password, $remember )
complete_login ( $user )

Method Details

__construct() public method

Loads Session and configuration options.
public __construct ( $config = [] ) : void
return void

_login() abstract protected method

abstract protected _login ( $username, $password, $remember )

check_password() abstract public method

abstract public check_password ( $password )

complete_login() protected method

protected complete_login ( $user )

factory() public static method

Create an instance of Auth.
public static factory ( $config = [] ) : Auth
return Auth

find_salt() public method

Finds the salt from a password, based on the configured salt pattern.
public find_salt ( $password ) : string
return string

get_user() public method

Returns FALSE if no user is currently logged in.
public get_user ( ) : mixed
return mixed

hash() public method

Perform a hash, using the configured method.
public hash ( $str ) : string
return string

hash_password() public method

Creates a hashed password from a plaintext password, inserting salt based on the configured salt pattern.
public hash_password ( $password, $salt = FALSE ) : string
return string hashed password string

instance() public static method

Singleton pattern
public static instance ( ) : Auth
return Auth

logged_in() public method

Check if there is an active session. Optionally allows checking for a specific role.
public logged_in ( $role = NULL ) : mixed
return mixed

login() public method

Attempt to log in a user by using an ORM object and plain-text password.
public login ( $username, $password, $remember = FALSE ) : boolean
return boolean

logout() public method

Log out a user by removing the related session variables.
public logout ( $destroy = FALSE, $logout_all = FALSE ) : boolean
return boolean

password() abstract public method

abstract public password ( $username )

Property Details

$_config protected property

protected $_config

$_instance protected static property

Auth instances
protected static $_instance

$_session protected property

protected $_session