PHP Class Airship\Engine\Security\AirBrake

Progressive rate-limiting
ファイルを表示 Open project: paragonie/airship

Protected Properties

Property Type Description
$config array
$db Database

Public Methods

Method Description
__construct ( Database $db = null, array $config = [] ) AirBrake constructor.
failFast ( string $username, string $ip, string $action = self::ACTION_LOGIN ) : boolean Returns true if we must fail fast and return an error message.
getAccountRecoveryAttempts ( string $username, string $ip ) : integer Get the number of recent account recovery attempts
getCutoff ( integer $expire ) : DateInterval Convert a number of seconds into the appropriate DateInterval
getDelay ( string $username, string $ip, string $action = self::ACTION_LOGIN ) : integer Get the throttling delay (in milliseconds)
getFailedLoginAttempts ( string $username, string $ip ) : integer Get the number of recent failed login attempts
getFastExit ( ) : boolean
getIPv4Subnet ( string $ip, integer $maskBits = 32 ) : string Return the given subnet for an IPv4 address and mask bits
getIPv6Subnet ( string $ip, integer $maskBits = 48 ) : string Return the given subnet for an IPv6 address and mask bits
getLogPublicKey ( string $publicKey = '' ) : EncryptionPublicKey Get the EncryptionPublicKey used for encrypting password guesses to give admins insight into the type of attack being launched.
getSubnet ( string $ip ) : string Return the given subnet for an IP and the configured mask bits
registerAccountRecoveryAttempt ( string $username, string $ip ) : boolean Register account recovery attempt
registerLoginFailure ( string $username, string $ip, integer $numFailures, HiddenString $password = null ) : boolean Register a failed login attempt

Method Details

__construct() public method

AirBrake constructor.
public __construct ( Database $db = null, array $config = [] )
$db Database
$config array

failFast() public method

Returns true if we must fail fast and return an error message.
public failFast ( string $username, string $ip, string $action = self::ACTION_LOGIN ) : boolean
$username string
$ip string
$action string
return boolean

getAccountRecoveryAttempts() public method

Get the number of recent account recovery attempts
public getAccountRecoveryAttempts ( string $username, string $ip ) : integer
$username string
$ip string
return integer

getCutoff() public method

Convert a number of seconds into the appropriate DateInterval
public getCutoff ( integer $expire ) : DateInterval
$expire integer
return DateInterval

getDelay() public method

Get the throttling delay (in milliseconds)
public getDelay ( string $username, string $ip, string $action = self::ACTION_LOGIN ) : integer
$username string
$ip string
$action string
return integer

getFailedLoginAttempts() public method

Get the number of recent failed login attempts
public getFailedLoginAttempts ( string $username, string $ip ) : integer
$username string
$ip string
return integer

getFastExit() public method

public getFastExit ( ) : boolean
return boolean

getIPv4Subnet() public method

Return the given subnet for an IPv4 address and mask bits
public getIPv4Subnet ( string $ip, integer $maskBits = 32 ) : string
$ip string
$maskBits integer
return string

getIPv6Subnet() public method

Return the given subnet for an IPv6 address and mask bits
public getIPv6Subnet ( string $ip, integer $maskBits = 48 ) : string
$ip string
$maskBits integer
return string

getLogPublicKey() public method

Get the EncryptionPublicKey used for encrypting password guesses to give admins insight into the type of attack being launched.
public getLogPublicKey ( string $publicKey = '' ) : EncryptionPublicKey
$publicKey string Hex-encoded public key
return EncryptionPublicKey

getSubnet() public method

Determine if the IP is an IPv4 or IPv6 address, then pass to the correct method for handling that specific type.
public getSubnet ( string $ip ) : string
$ip string
return string

registerAccountRecoveryAttempt() public method

Register account recovery attempt
public registerAccountRecoveryAttempt ( string $username, string $ip ) : boolean
$username string
$ip string
return boolean

registerLoginFailure() public method

Register a failed login attempt
public registerLoginFailure ( string $username, string $ip, integer $numFailures, HiddenString $password = null ) : boolean
$username string
$ip string
$numFailures integer
$password HiddenString
return boolean

Property Details

$config protected_oe property

protected array $config
return array

$db protected_oe property

protected Database $db
return Database