PHP Class Pop\Auth\Auth

Author: Nick Sagona, III ([email protected])
Afficher le fichier Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Свойство Type Description
$adapter mixed Auth adapter object
$attempts integer Current number of login attempts
$encryption integer Encryption method to use
$encryptionOptions array 'salt' // Custom Salt 'secret' // Secret pepper 'cost' // Bcrypt cost 'prefix' // Bcrypt prefix 'rounds' // Sha rounds 'cipher' // Mcrypt cipher 'mode' // Mcrypt cipher 'source' // Mcrypt source
$ip string Current IP address
$isValid boolean User validation result from authentication
$result integer Authentication result
$subnet array Current subnet
$validators array Array of validator objects

Méthodes publiques

Méthode Description
__construct ( Pop\Auth\Adapter\AdapterInterface $adapter, integer $encryption, array $options = [] ) : Auth Constructor
authenticate ( string $username, string $password ) : integer Method to authenticate a user
factory ( Pop\Auth\Adapter\AdapterInterface $adapter, integer $encryption ) : Auth Static method to instantiate the auth object and return itself to facilitate chaining methods together.
getAttempts ( ) : integer Method to get the current number of login attempts
getEncryption ( ) : integer Method to get the encryption
getEncryptionOptions ( ) : array Method to get the encryption options
getResult ( ) : integer Method to get the authentication result
getResultMessage ( ) : string Method to get the authentication result message
getUser ( ) : array Method to get the user data array from the adapter
getValidator ( string $name ) : mixed Method to get a validator
isValid ( ) : boolean Method to determine if the user is valid
setAllowedIps ( string | array $ips = null ) : Auth Method to set the allowed IP addresses
setAllowedSubnets ( string | array $subnets = null ) : Auth Method to set the allowed subnets
setAttemptLimit ( integer $attempts ) : Auth Method to set the number of attempts allowed
setAttempts ( integer $attempts ) : Auth Method to set the number of attempts allowed
setBlockedIps ( string | array $ips = null ) : Auth Method to set the block IP addresses
setBlockedSubnets ( string | array $subnets = null ) : Auth Method to set the block subnets
setEncryption ( integer $encryption ) : Auth Method to set the encryption
setEncryptionOptions ( array $options = [] ) : Auth Method to set the encryption options

Méthodes protégées

Méthode Description
filterIps ( string | array $ips ) : array Method to filter the ip addresses to confirm their validity
filterSubnets ( string | array $subnets ) : array Method to filter the subnets to confirm their validity
processValidators ( ) : void Method to process the validators

Method Details

__construct() public méthode

Instantiate the auth object
public __construct ( Pop\Auth\Adapter\AdapterInterface $adapter, integer $encryption, array $options = [] ) : Auth
$adapter Pop\Auth\Adapter\AdapterInterface
$encryption integer
$options array
Résultat Auth

authenticate() public méthode

Method to authenticate a user
public authenticate ( string $username, string $password ) : integer
$username string
$password string
Résultat integer

factory() public static méthode

Static method to instantiate the auth object and return itself to facilitate chaining methods together.
public static factory ( Pop\Auth\Adapter\AdapterInterface $adapter, integer $encryption ) : Auth
$adapter Pop\Auth\Adapter\AdapterInterface
$encryption integer
Résultat Auth

filterIps() protected méthode

Method to filter the ip addresses to confirm their validity
protected filterIps ( string | array $ips ) : array
$ips string | array
Résultat array

filterSubnets() protected méthode

Method to filter the subnets to confirm their validity
protected filterSubnets ( string | array $subnets ) : array
$subnets string | array
Résultat array

getAttempts() public méthode

Method to get the current number of login attempts
public getAttempts ( ) : integer
Résultat integer

getEncryption() public méthode

Method to get the encryption
public getEncryption ( ) : integer
Résultat integer

getEncryptionOptions() public méthode

Method to get the encryption options
public getEncryptionOptions ( ) : array
Résultat array

getResult() public méthode

Method to get the authentication result
public getResult ( ) : integer
Résultat integer

getResultMessage() public méthode

Method to get the authentication result message
public getResultMessage ( ) : string
Résultat string

getUser() public méthode

Method to get the user data array from the adapter
public getUser ( ) : array
Résultat array

getValidator() public méthode

Method to get a validator
public getValidator ( string $name ) : mixed
$name string
Résultat mixed

isValid() public méthode

Method to determine if the user is valid
public isValid ( ) : boolean
Résultat boolean

processValidators() protected méthode

Method to process the validators
protected processValidators ( ) : void
Résultat void

setAllowedIps() public méthode

Method to set the allowed IP addresses
public setAllowedIps ( string | array $ips = null ) : Auth
$ips string | array
Résultat Auth

setAllowedSubnets() public méthode

Method to set the allowed subnets
public setAllowedSubnets ( string | array $subnets = null ) : Auth
$subnets string | array
Résultat Auth

setAttemptLimit() public méthode

Method to set the number of attempts allowed
public setAttemptLimit ( integer $attempts ) : Auth
$attempts integer
Résultat Auth

setAttempts() public méthode

Method to set the number of attempts allowed
public setAttempts ( integer $attempts ) : Auth
$attempts integer
Résultat Auth

setBlockedIps() public méthode

Method to set the block IP addresses
public setBlockedIps ( string | array $ips = null ) : Auth
$ips string | array
Résultat Auth

setBlockedSubnets() public méthode

Method to set the block subnets
public setBlockedSubnets ( string | array $subnets = null ) : Auth
$subnets string | array
Résultat Auth

setEncryption() public méthode

Method to set the encryption
public setEncryption ( integer $encryption ) : Auth
$encryption integer
Résultat Auth

setEncryptionOptions() public méthode

Method to set the encryption options
public setEncryptionOptions ( array $options = [] ) : Auth
$options array
Résultat Auth

Property Details

$adapter protected_oe property

Auth adapter object
protected mixed $adapter
Résultat mixed

$attempts protected_oe property

Current number of login attempts
protected int $attempts
Résultat integer

$encryption protected_oe property

Encryption method to use
protected int $encryption
Résultat integer

$encryptionOptions protected_oe property

'salt' // Custom Salt 'secret' // Secret pepper 'cost' // Bcrypt cost 'prefix' // Bcrypt prefix 'rounds' // Sha rounds 'cipher' // Mcrypt cipher 'mode' // Mcrypt cipher 'source' // Mcrypt source
protected array $encryptionOptions
Résultat array

$ip protected_oe property

Current IP address
protected string $ip
Résultat string

$isValid protected_oe property

User validation result from authentication
protected bool $isValid
Résultat boolean

$result protected_oe property

Authentication result
protected int $result
Résultat integer

$subnet protected_oe property

Current subnet
protected array $subnet
Résultat array

$validators protected_oe property

Array of validator objects
protected array $validators
Résultat array