PHP Класс Bolt\AccessControl\AccessChecker

Автор: Gawain Lynch ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$cookieOptions array
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$flashLogger Bolt\Logger\FlashLoggerInterface
$permissions Bolt\AccessControl\Permissions
$randomGenerator Bolt\Security\Random\Generator
$requestStack Symfony\Component\HttpFoundation\RequestStack
$session Symfony\Component\HttpFoundation\Session\SessionInterface
$systemLogger Psr\Log\LoggerInterface
$validSession boolean

Открытые методы

Метод Описание
__construct ( Bolt\Storage\EntityManagerInterface $em, Symfony\Component\HttpFoundation\RequestStack $requestStack, Symfony\Component\HttpFoundation\Session\SessionInterface $session, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher, Bolt\Logger\FlashLoggerInterface $flashLogger, Psr\Log\LoggerInterface $systemLogger, Bolt\AccessControl\Permissions $permissions, Generator $randomGenerator, array $cookieOptions ) Constructor.
getActiveSessions ( ) : array Lookup active sessions.
isValidSession ( string $authCookie ) : boolean We will not allow tampering with sessions, so we make sure the current session is still valid for the device on which it was created, and that the username, and IP address, are still the same.
revokeSession ( ) : boolean Log out the currently logged in user.

Защищенные методы

Метод Описание
checkSessionDatabase ( string $authCookie ) : boolean Check the user authentication cookie against what is stored in the database.
checkSessionKeys ( Token $sessionAuth ) : boolean Check the session is still valid for the device on which it was created, and. i.e. the username, IP address, and (if configured) the browser agent values are all still the same.
checkSessionStored ( Token $sessionAuth ) : boolean Check the stored session, if we're past expiry then return false regardless and force a check/update from the database authentication record.
getAuthToken ( string $username, string $salt ) : string | boolean Get a MD5 hash key to identify the session with. This is calculated from a name, a salt, and optionally the remote IP address, broswer's agent string and the user's HTTP hostname.
getClientHost ( ) : string Return the user's host name.
getClientIp ( ) : string Return the user's IP address.
getClientUserAgent ( ) : string Return the user's browser User Agent.
getRepositoryAuthtoken ( ) : Bolt\Storage\Repository\AuthtokenRepository
getRepositoryUsers ( ) : UsersRepository

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( Bolt\Storage\EntityManagerInterface $em, Symfony\Component\HttpFoundation\RequestStack $requestStack, Symfony\Component\HttpFoundation\Session\SessionInterface $session, Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher, Bolt\Logger\FlashLoggerInterface $flashLogger, Psr\Log\LoggerInterface $systemLogger, Bolt\AccessControl\Permissions $permissions, Generator $randomGenerator, array $cookieOptions )
$em Bolt\Storage\EntityManagerInterface
$requestStack Symfony\Component\HttpFoundation\RequestStack
$session Symfony\Component\HttpFoundation\Session\SessionInterface
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$flashLogger Bolt\Logger\FlashLoggerInterface
$systemLogger Psr\Log\LoggerInterface
$permissions Bolt\AccessControl\Permissions
$randomGenerator Bolt\Security\Random\Generator
$cookieOptions array

checkSessionDatabase() защищенный Метод

Check the user authentication cookie against what is stored in the database.
protected checkSessionDatabase ( string $authCookie ) : boolean
$authCookie string
Результат boolean

checkSessionKeys() защищенный Метод

Check the session is still valid for the device on which it was created, and. i.e. the username, IP address, and (if configured) the browser agent values are all still the same.
protected checkSessionKeys ( Token $sessionAuth ) : boolean
$sessionAuth Bolt\AccessControl\Token\Token
Результат boolean

checkSessionStored() защищенный Метод

Check the stored session, if we're past expiry then return false regardless and force a check/update from the database authentication record.
protected checkSessionStored ( Token $sessionAuth ) : boolean
$sessionAuth Bolt\AccessControl\Token\Token
Результат boolean

getActiveSessions() публичный Метод

Lookup active sessions.
public getActiveSessions ( ) : array
Результат array

getAuthToken() защищенный Метод

Get a MD5 hash key to identify the session with. This is calculated from a name, a salt, and optionally the remote IP address, broswer's agent string and the user's HTTP hostname.
protected getAuthToken ( string $username, string $salt ) : string | boolean
$username string
$salt string
Результат string | boolean

getClientHost() защищенный Метод

Return the user's host name.
protected getClientHost ( ) : string
Результат string

getClientIp() защищенный Метод

Return the user's IP address.
protected getClientIp ( ) : string
Результат string

getClientUserAgent() защищенный Метод

Return the user's browser User Agent.
protected getClientUserAgent ( ) : string
Результат string

getRepositoryAuthtoken() защищенный Метод

protected getRepositoryAuthtoken ( ) : Bolt\Storage\Repository\AuthtokenRepository
Результат Bolt\Storage\Repository\AuthtokenRepository

getRepositoryUsers() защищенный Метод

protected getRepositoryUsers ( ) : UsersRepository
Результат Bolt\Storage\Repository\UsersRepository

isValidSession() публичный Метод

1. If user has a valid session and it is fresh, check against cookie: - If NOT a match refuse - If a match accept 2. If user has a valid session and it is stale (>10 minutes), check the database records again: - If disabled refuse - If enabled - If NOT a match refuse - If a match accept - Update session data 3. If user has no session check authtoken table entry (closed broswer): - If passed validity date refuse - If within validity date, hash username and IP against salt and compare to database: - If NOT a match refuse - If a match accept
public isValidSession ( string $authCookie ) : boolean
$authCookie string
Результат boolean

revokeSession() публичный Метод

Log out the currently logged in user.
public revokeSession ( ) : boolean
Результат boolean

Описание свойств

$cookieOptions защищенное свойство

protected array $cookieOptions
Результат array

$dispatcher защищенное свойство

protected EventDispatcherInterface,Symfony\Component\EventDispatcher $dispatcher
Результат Symfony\Component\EventDispatcher\EventDispatcherInterface

$flashLogger защищенное свойство

protected FlashLoggerInterface,Bolt\Logger $flashLogger
Результат Bolt\Logger\FlashLoggerInterface

$permissions защищенное свойство

protected Permissions,Bolt\AccessControl $permissions
Результат Bolt\AccessControl\Permissions

$randomGenerator защищенное свойство

protected Generator,Bolt\Security\Random $randomGenerator
Результат Bolt\Security\Random\Generator

$requestStack защищенное свойство

protected RequestStack,Symfony\Component\HttpFoundation $requestStack
Результат Symfony\Component\HttpFoundation\RequestStack

$session защищенное свойство

protected SessionInterface,Symfony\Component\HttpFoundation\Session $session
Результат Symfony\Component\HttpFoundation\Session\SessionInterface

$systemLogger защищенное свойство

protected LoggerInterface,Psr\Log $systemLogger
Результат Psr\Log\LoggerInterface

$validSession защищенное свойство

protected bool $validSession
Результат boolean