PHP Class Bolt\AccessControl\Login

Author: Gawain Lynch ([email protected])
Inheritance: extends AccessChecker
Show file Open project: bolt/bolt Class Usage Examples

Protected Properties

Property Type Description
$authTokenName string
$passwordFactory PasswordLib\Password\Factory

Public Methods

Method Description
__construct ( Silex\Application $app ) Constructor.
login ( string $userName, string $password, Bolt\Events\AccessControlEvent $event ) : boolean Attempt to login a user with the given password. Accepts username or email.

Protected Methods

Method Description
getUserEntity ( string $userName ) : Bolt\Storage\Entity\Users | null Get the user record entity if it exists.
loginCheckAuthtoken ( string $authCookie, Bolt\Events\AccessControlEvent $event ) : boolean Attempt to login a user via the bolt_authtoken cookie.
loginCheckPassword ( string $userName, string $password, Bolt\Events\AccessControlEvent $event ) : boolean Check a user login request for username/password combinations.
loginFailed ( Bolt\Storage\Entity\Users $userEntity ) : false Add error messages to logs and update the user.
loginFinish ( Bolt\Storage\Entity\Users $userEntity ) : boolean Finish user login process(es).
updateAuthToken ( Bolt\Storage\Entity\Users $userEntity ) : Bolt\Storage\Entity\Authtoken Set the Authtoken cookie and DB-entry. If it's already present, update it.
updateUserLogin ( Bolt\Storage\Entity\Users $userEntity ) : boolean Update the user record with latest login information.
updateUserShadowLogin ( Bolt\Storage\Entity\Users $userEntity ) : Bolt\Storage\Entity\Users Remove expired shadow login data.

Private Methods

Method Description
throttleUntil ( integer $attempts ) : DateTime Calculate the amount of time until we should throttle login attempts for a user.

Method Details

__construct() public method

Constructor.
public __construct ( Silex\Application $app )
$app Silex\Application

getUserEntity() protected method

Get the user record entity if it exists.
protected getUserEntity ( string $userName ) : Bolt\Storage\Entity\Users | null
$userName string
return Bolt\Storage\Entity\Users | null

login() public method

Attempt to login a user with the given password. Accepts username or email.
public login ( string $userName, string $password, Bolt\Events\AccessControlEvent $event ) : boolean
$userName string
$password string
$event Bolt\Events\AccessControlEvent
return boolean

loginCheckAuthtoken() protected method

Attempt to login a user via the bolt_authtoken cookie.
protected loginCheckAuthtoken ( string $authCookie, Bolt\Events\AccessControlEvent $event ) : boolean
$authCookie string
$event Bolt\Events\AccessControlEvent
return boolean

loginCheckPassword() protected method

Check a user login request for username/password combinations.
protected loginCheckPassword ( string $userName, string $password, Bolt\Events\AccessControlEvent $event ) : boolean
$userName string
$password string
$event Bolt\Events\AccessControlEvent
return boolean

loginFailed() protected method

Add error messages to logs and update the user.
protected loginFailed ( Bolt\Storage\Entity\Users $userEntity ) : false
$userEntity Bolt\Storage\Entity\Users
return false

loginFinish() protected method

Finish user login process(es).
protected loginFinish ( Bolt\Storage\Entity\Users $userEntity ) : boolean
$userEntity Bolt\Storage\Entity\Users
return boolean

updateAuthToken() protected method

Set the Authtoken cookie and DB-entry. If it's already present, update it.
protected updateAuthToken ( Bolt\Storage\Entity\Users $userEntity ) : Bolt\Storage\Entity\Authtoken
$userEntity Bolt\Storage\Entity\Users
return Bolt\Storage\Entity\Authtoken

updateUserLogin() protected method

Update the user record with latest login information.
protected updateUserLogin ( Bolt\Storage\Entity\Users $userEntity ) : boolean
$userEntity Bolt\Storage\Entity\Users
return boolean

updateUserShadowLogin() protected method

Remove expired shadow login data.
protected updateUserShadowLogin ( Bolt\Storage\Entity\Users $userEntity ) : Bolt\Storage\Entity\Users
$userEntity Bolt\Storage\Entity\Users
return Bolt\Storage\Entity\Users

Property Details

$authTokenName protected property

protected string $authTokenName
return string

$passwordFactory protected property

protected Factory,PasswordLib\Password $passwordFactory
return PasswordLib\Password\Factory