PHP Class Cartalyst\Sentinel\Sentinel

Inheritance: use trait Cartalyst\Support\Traits\EventTrait
Afficher le fichier Open project: cartalyst/sentinel Class Usage Examples

Protected Properties

Свойство Type Description
$activations Cartalyst\Sentinel\Activations\ActivationRepositoryInterface The Activations repository.
$basicResponse Closure The closure used to create a basic response for failed HTTP auth.
$checkpoints array Array that holds all the enabled checkpoints.
$checkpointsStatus boolean Flag for the checkpoint status.
$persistences Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface The Persistence repository.
$reminders Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface The Reminders repository.
$requestCredentials Closure The closure to retrieve the request credentials.
$roles Cartalyst\Sentinel\Roles\RoleRepositoryInterface The Role repository.
$throttle Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface The Throttle repository.
$user Cartalyst\Sentinel\Users\UserInterface The current cached, logged in user.
$userMethods array Cached, available methods on the user repository, used for dynamic calls.
$users Cartalyst\Sentinel\Users\UserRepositoryInterface The User repository.

Méthodes publiques

Méthode Description
__call ( string $method, array $parameters ) : mixed Dynamically pass missing methods to Sentinel.
__construct ( Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface $persistences, Cartalyst\Sentinel\Users\UserRepositoryInterface $users, Cartalyst\Sentinel\Roles\RoleRepositoryInterface $roles, Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations, Illuminate\Events\Dispatcher $dispatcher ) : void Create a new Sentinel instance.
activate ( mixed $user ) : boolean Activates the given user.
addCheckpoint ( string $key, Cartalyst\Sentinel\Checkpoints\CheckpointInterface $checkpoint ) : void Add a new checkpoint to Sentinel.
authenticate ( Cartalyst\Sentinel\Users\UserInterface | array $credentials, boolean $remember = false, boolean $login = true ) : Cartalyst\Sentinel\Users\UserInterface | boolean Authenticates a user, with "remember" flag.
authenticateAndRemember ( Cartalyst\Sentinel\Users\UserInterface | array $credentials ) : Cartalyst\Sentinel\Users\UserInterface | boolean Authenticates a user, with the "remember" flag.
basic ( ) : mixed Attempt to authenticate using HTTP Basic Auth.
bypassCheckpoints ( Closure $callback, array $checkpoints = [] ) : mixed Pass a closure to Sentinel to bypass checkpoints.
check ( ) : Cartalyst\Sentinel\Users\UserInterface | boolean Checks to see if a user is logged in.
checkpointsStatus ( ) : boolean Checks if checkpoints are enabled.
creatingBasicResponse ( Closure $basicResponse ) : void Sets the callback which creates a basic response.
disableCheckpoints ( ) : void Disables checkpoints.
enableCheckpoints ( ) : void Enables checkpoints.
forceAuthenticate ( Cartalyst\Sentinel\Users\UserInterface | array $credentials, boolean $remember = false ) : Cartalyst\Sentinel\Users\UserInterface | boolean Forces an authentication to bypass checkpoints.
forceAuthenticateAndRemember ( Cartalyst\Sentinel\Users\UserInterface | array $credentials ) : Cartalyst\Sentinel\Users\UserInterface | boolean Forces an authentication to bypass checkpoints, with the "remember" flag.
forceCheck ( ) : Cartalyst\Sentinel\Users\UserInterface | boolean Checks to see if a user is logged in, bypassing checkpoints
getActivationRepository ( ) : Cartalyst\Sentinel\Activations\ActivationRepositoryInterface Returns the activations repository.
getBasicResponse ( ) : mixed Sends a response when HTTP basic authentication fails.
getPersistenceRepository ( ) : Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface Returns the persistences repository.
getReminderRepository ( ) : Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface Returns the reminders repository.
getRequestCredentials ( ) : array Returns the request credentials.
getRoleRepository ( ) : Cartalyst\Sentinel\Roles\RoleRepositoryInterface Returns the role repository.
getThrottleRepository ( ) : Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface Returns the throttle repository.
getUser ( boolean $check = true ) : Cartalyst\Sentinel\Users\UserInterface Returns the currently logged in user, lazily checking for it.
getUserRepository ( ) : Cartalyst\Sentinel\Users\UserRepositoryInterface Returns the user repository.
guest ( ) : boolean Checks if we are currently a guest.
login ( Cartalyst\Sentinel\Users\UserInterface $user, boolean $remember = false ) : Cartalyst\Sentinel\Users\UserInterface | boolean Persists a login for the given user.
loginAndRemember ( Cartalyst\Sentinel\Users\UserInterface $user ) : Cartalyst\Sentinel\Users\UserInterface | boolean Persists a login for the given user, with the "remember" flag.
logout ( Cartalyst\Sentinel\Users\UserInterface $user = null, boolean $everywhere = false ) : boolean Logs the current user out.
register ( array $credentials, Closure | boolean $callback = null ) : Cartalyst\Sentinel\Users\UserInteface | boolean Registers a user. You may provide a callback to occur before the user is saved, or provide a true boolean as a shortcut to activation.
registerAndActivate ( array $credentials ) : Cartalyst\Sentinel\Users\UserInteface | boolean Registers and activates the user.
removeCheckpoint ( string $key ) : void Removes a checkpoint.
removeCheckpoints ( array $checkpoints = [] ) : void Removes the given checkpoints.
setActivationRepository ( Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations ) : void Sets the activations repository.
setPersistenceRepository ( Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface $persistences ) : void Sets the persistences repository.
setReminderRepository ( Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface $reminders ) : void Sets the reminders repository.
setRequestCredentials ( Closure $requestCredentials ) : void Sets the closure which resolves the request credentials.
setRoleRepository ( Cartalyst\Sentinel\Roles\RoleRepositoryInterface $roles ) : void Sets the role repository.
setThrottleRepository ( Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface $throttle ) : void Sets the throttle repository.
setUser ( Cartalyst\Sentinel\Users\UserInterface $user ) : void Sets the user associated with Sentinel (does not log in).
setUserRepository ( Cartalyst\Sentinel\Users\UserRepositoryInterface $users ) : void Sets the user repository.
stateless ( Cartalyst\Sentinel\Users\UserInterface | array $credentials ) : Cartalyst\Sentinel\Users\UserInterface | boolean Attempt a stateless authentication.

Méthodes protégées

Méthode Description
cycleCheckpoints ( string $method, Cartalyst\Sentinel\Users\UserInterface $user = null, boolean $halt = true ) : boolean Cycles through all the registered checkpoints for a user. Checkpoints may throw their own exceptions, however, if just one returns false, the cycle fails.
getUserMethods ( ) : array Returns all accessible methods on the associated user repository.

Method Details

__call() public méthode

Dynamically pass missing methods to Sentinel.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
Résultat mixed

__construct() public méthode

Create a new Sentinel instance.
public __construct ( Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface $persistences, Cartalyst\Sentinel\Users\UserRepositoryInterface $users, Cartalyst\Sentinel\Roles\RoleRepositoryInterface $roles, Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations, Illuminate\Events\Dispatcher $dispatcher ) : void
$persistences Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface
$users Cartalyst\Sentinel\Users\UserRepositoryInterface
$roles Cartalyst\Sentinel\Roles\RoleRepositoryInterface
$activations Cartalyst\Sentinel\Activations\ActivationRepositoryInterface
$dispatcher Illuminate\Events\Dispatcher
Résultat void

activate() public méthode

Activates the given user.
public activate ( mixed $user ) : boolean
$user mixed
Résultat boolean

addCheckpoint() public méthode

Add a new checkpoint to Sentinel.
public addCheckpoint ( string $key, Cartalyst\Sentinel\Checkpoints\CheckpointInterface $checkpoint ) : void
$key string
$checkpoint Cartalyst\Sentinel\Checkpoints\CheckpointInterface
Résultat void

authenticate() public méthode

Authenticates a user, with "remember" flag.
public authenticate ( Cartalyst\Sentinel\Users\UserInterface | array $credentials, boolean $remember = false, boolean $login = true ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$credentials Cartalyst\Sentinel\Users\UserInterface | array
$remember boolean
$login boolean
Résultat Cartalyst\Sentinel\Users\UserInterface | boolean

authenticateAndRemember() public méthode

Authenticates a user, with the "remember" flag.
public authenticateAndRemember ( Cartalyst\Sentinel\Users\UserInterface | array $credentials ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$credentials Cartalyst\Sentinel\Users\UserInterface | array
Résultat Cartalyst\Sentinel\Users\UserInterface | boolean

basic() public méthode

Attempt to authenticate using HTTP Basic Auth.
public basic ( ) : mixed
Résultat mixed

bypassCheckpoints() public méthode

Pass a closure to Sentinel to bypass checkpoints.
public bypassCheckpoints ( Closure $callback, array $checkpoints = [] ) : mixed
$callback Closure
$checkpoints array
Résultat mixed

check() public méthode

Checks to see if a user is logged in.
public check ( ) : Cartalyst\Sentinel\Users\UserInterface | boolean
Résultat Cartalyst\Sentinel\Users\UserInterface | boolean

checkpointsStatus() public méthode

Checks if checkpoints are enabled.
public checkpointsStatus ( ) : boolean
Résultat boolean

creatingBasicResponse() public méthode

Sets the callback which creates a basic response.
public creatingBasicResponse ( Closure $basicResponse ) : void
$basicResponse Closure
Résultat void

cycleCheckpoints() protected méthode

Cycles through all the registered checkpoints for a user. Checkpoints may throw their own exceptions, however, if just one returns false, the cycle fails.
protected cycleCheckpoints ( string $method, Cartalyst\Sentinel\Users\UserInterface $user = null, boolean $halt = true ) : boolean
$method string
$user Cartalyst\Sentinel\Users\UserInterface
$halt boolean
Résultat boolean

disableCheckpoints() public méthode

Disables checkpoints.
public disableCheckpoints ( ) : void
Résultat void

enableCheckpoints() public méthode

Enables checkpoints.
public enableCheckpoints ( ) : void
Résultat void

forceAuthenticate() public méthode

Forces an authentication to bypass checkpoints.
public forceAuthenticate ( Cartalyst\Sentinel\Users\UserInterface | array $credentials, boolean $remember = false ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$credentials Cartalyst\Sentinel\Users\UserInterface | array
$remember boolean
Résultat Cartalyst\Sentinel\Users\UserInterface | boolean

forceAuthenticateAndRemember() public méthode

Forces an authentication to bypass checkpoints, with the "remember" flag.
public forceAuthenticateAndRemember ( Cartalyst\Sentinel\Users\UserInterface | array $credentials ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$credentials Cartalyst\Sentinel\Users\UserInterface | array
Résultat Cartalyst\Sentinel\Users\UserInterface | boolean

forceCheck() public méthode

Checks to see if a user is logged in, bypassing checkpoints
public forceCheck ( ) : Cartalyst\Sentinel\Users\UserInterface | boolean
Résultat Cartalyst\Sentinel\Users\UserInterface | boolean

getActivationRepository() public méthode

Returns the activations repository.
public getActivationRepository ( ) : Cartalyst\Sentinel\Activations\ActivationRepositoryInterface
Résultat Cartalyst\Sentinel\Activations\ActivationRepositoryInterface

getBasicResponse() public méthode

Sends a response when HTTP basic authentication fails.
public getBasicResponse ( ) : mixed
Résultat mixed

getPersistenceRepository() public méthode

Returns the persistences repository.
public getPersistenceRepository ( ) : Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface
Résultat Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface

getReminderRepository() public méthode

Returns the reminders repository.
public getReminderRepository ( ) : Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface
Résultat Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface

getRequestCredentials() public méthode

Returns the request credentials.
public getRequestCredentials ( ) : array
Résultat array

getRoleRepository() public méthode

Returns the role repository.
public getRoleRepository ( ) : Cartalyst\Sentinel\Roles\RoleRepositoryInterface
Résultat Cartalyst\Sentinel\Roles\RoleRepositoryInterface

getThrottleRepository() public méthode

Returns the throttle repository.
public getThrottleRepository ( ) : Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface
Résultat Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface

getUser() public méthode

Returns the currently logged in user, lazily checking for it.
public getUser ( boolean $check = true ) : Cartalyst\Sentinel\Users\UserInterface
$check boolean
Résultat Cartalyst\Sentinel\Users\UserInterface

getUserMethods() protected méthode

Returns all accessible methods on the associated user repository.
protected getUserMethods ( ) : array
Résultat array

getUserRepository() public méthode

Returns the user repository.
public getUserRepository ( ) : Cartalyst\Sentinel\Users\UserRepositoryInterface
Résultat Cartalyst\Sentinel\Users\UserRepositoryInterface

guest() public méthode

Checks if we are currently a guest.
public guest ( ) : boolean
Résultat boolean

login() public méthode

Persists a login for the given user.
public login ( Cartalyst\Sentinel\Users\UserInterface $user, boolean $remember = false ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$user Cartalyst\Sentinel\Users\UserInterface
$remember boolean
Résultat Cartalyst\Sentinel\Users\UserInterface | boolean

loginAndRemember() public méthode

Persists a login for the given user, with the "remember" flag.
public loginAndRemember ( Cartalyst\Sentinel\Users\UserInterface $user ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$user Cartalyst\Sentinel\Users\UserInterface
Résultat Cartalyst\Sentinel\Users\UserInterface | boolean

logout() public méthode

Logs the current user out.
public logout ( Cartalyst\Sentinel\Users\UserInterface $user = null, boolean $everywhere = false ) : boolean
$user Cartalyst\Sentinel\Users\UserInterface
$everywhere boolean
Résultat boolean

register() public méthode

Registers a user. You may provide a callback to occur before the user is saved, or provide a true boolean as a shortcut to activation.
public register ( array $credentials, Closure | boolean $callback = null ) : Cartalyst\Sentinel\Users\UserInteface | boolean
$credentials array
$callback Closure | boolean
Résultat Cartalyst\Sentinel\Users\UserInteface | boolean

registerAndActivate() public méthode

Registers and activates the user.
public registerAndActivate ( array $credentials ) : Cartalyst\Sentinel\Users\UserInteface | boolean
$credentials array
Résultat Cartalyst\Sentinel\Users\UserInteface | boolean

removeCheckpoint() public méthode

Removes a checkpoint.
public removeCheckpoint ( string $key ) : void
$key string
Résultat void

removeCheckpoints() public méthode

Removes the given checkpoints.
public removeCheckpoints ( array $checkpoints = [] ) : void
$checkpoints array
Résultat void

setActivationRepository() public méthode

Sets the activations repository.
public setActivationRepository ( Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations ) : void
$activations Cartalyst\Sentinel\Activations\ActivationRepositoryInterface
Résultat void

setPersistenceRepository() public méthode

Sets the persistences repository.
public setPersistenceRepository ( Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface $persistences ) : void
$persistences Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface
Résultat void

setReminderRepository() public méthode

Sets the reminders repository.
public setReminderRepository ( Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface $reminders ) : void
$reminders Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface
Résultat void

setRequestCredentials() public méthode

Sets the closure which resolves the request credentials.
public setRequestCredentials ( Closure $requestCredentials ) : void
$requestCredentials Closure
Résultat void

setRoleRepository() public méthode

Sets the role repository.
public setRoleRepository ( Cartalyst\Sentinel\Roles\RoleRepositoryInterface $roles ) : void
$roles Cartalyst\Sentinel\Roles\RoleRepositoryInterface
Résultat void

setThrottleRepository() public méthode

Sets the throttle repository.
public setThrottleRepository ( Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface $throttle ) : void
$throttle Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface
Résultat void

setUser() public méthode

Sets the user associated with Sentinel (does not log in).
public setUser ( Cartalyst\Sentinel\Users\UserInterface $user ) : void
$user Cartalyst\Sentinel\Users\UserInterface
Résultat void

setUserRepository() public méthode

Sets the user repository.
public setUserRepository ( Cartalyst\Sentinel\Users\UserRepositoryInterface $users ) : void
$users Cartalyst\Sentinel\Users\UserRepositoryInterface
Résultat void

stateless() public méthode

Attempt a stateless authentication.
public stateless ( Cartalyst\Sentinel\Users\UserInterface | array $credentials ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$credentials Cartalyst\Sentinel\Users\UserInterface | array
Résultat Cartalyst\Sentinel\Users\UserInterface | boolean

Property Details

$activations protected_oe property

The Activations repository.
protected ActivationRepositoryInterface,Cartalyst\Sentinel\Activations $activations
Résultat Cartalyst\Sentinel\Activations\ActivationRepositoryInterface

$basicResponse protected_oe property

The closure used to create a basic response for failed HTTP auth.
protected Closure $basicResponse
Résultat Closure

$checkpoints protected_oe property

Array that holds all the enabled checkpoints.
protected array $checkpoints
Résultat array

$checkpointsStatus protected_oe property

Flag for the checkpoint status.
protected bool $checkpointsStatus
Résultat boolean

$persistences protected_oe property

The Persistence repository.
protected PersistenceRepositoryInterface,Cartalyst\Sentinel\Persistences $persistences
Résultat Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface

$reminders protected_oe property

The Reminders repository.
protected ReminderRepositoryInterface,Cartalyst\Sentinel\Reminders $reminders
Résultat Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface

$requestCredentials protected_oe property

The closure to retrieve the request credentials.
protected Closure $requestCredentials
Résultat Closure

$roles protected_oe property

The Role repository.
protected RoleRepositoryInterface,Cartalyst\Sentinel\Roles $roles
Résultat Cartalyst\Sentinel\Roles\RoleRepositoryInterface

$throttle protected_oe property

The Throttle repository.
protected ThrottleRepositoryInterface,Cartalyst\Sentinel\Throttling $throttle
Résultat Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface

$user protected_oe property

The current cached, logged in user.
protected UserInterface,Cartalyst\Sentinel\Users $user
Résultat Cartalyst\Sentinel\Users\UserInterface

$userMethods protected_oe property

Cached, available methods on the user repository, used for dynamic calls.
protected array $userMethods
Résultat array

$users protected_oe property

The User repository.
protected UserRepositoryInterface,Cartalyst\Sentinel\Users $users
Résultat Cartalyst\Sentinel\Users\UserRepositoryInterface