PHP Класс Thruway\Authentication\AuthorizationManager

Наследование: extends Thruway\Peer\Client, implements Thruway\Authentication\AuthorizationManagerInterface
Показать файл Открыть проект

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

Метод Описание
__construct ( string $realm, null $loop = null )
addAuthorizationRule ( $args ) : string rules look like (JSON) { "role": "some_role", "action": "publish", "uri": "some.uri", "allow": true }
flushAuthorizationRules ( boolean $allowByDefault = false ) : string
getAuthorizationRules ( ) : Result
getSubscribedEvents ( ) : array Listen for Router events
getSubscribedRealmEvents ( ) : array
handleMessage ( MessageEvent $messageEvent )
handleNewRealm ( NewRealmEvent $newRealmEvent )
initModule ( Thruway\Peer\RouterInterface $router, React\EventLoop\LoopInterface $loop ) Gets called when the module is initialized in the router
isAuthorizedTo ( Session $session, Thruway\Message\ActionMessageInterface $actionMsg ) : boolean Check to see if an action is authorized on a specific uri given the context of the session attempting the action
isReady ( ) : boolean
isValidAction ( $action ) : boolean
isValidRuleUri ( $uri ) : boolean
onSessionStart ( ClientSession $session, Thruway\Transport\TransportInterface $transport )
removeAuthorizationRule ( $args )
setReady ( boolean $ready )
testAuthorization ( $args ) : boolean | mixed Arguments need to be [["role1", "role2"], "publish|subscribe|register|call", "my.uri"]

Приватные методы

Метод Описание
getRuleFromArgs ( $args ) : stdClass | boolean
isAuthorizedByRolesActionAndUri ( $rolesToCheck, $action, $uri ) : boolean | mixed

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

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

public __construct ( string $realm, null $loop = null )
$realm string
$loop null

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

Should be $args[0]
public addAuthorizationRule ( $args ) : string
$args
Результат string

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

public flushAuthorizationRules ( boolean $allowByDefault = false ) : string
$allowByDefault boolean
Результат string

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

public getAuthorizationRules ( ) : Result
Результат Thruway\Result

getSubscribedEvents() публичный статический Метод

Listen for Router events
public static getSubscribedEvents ( ) : array
Результат array

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

public getSubscribedRealmEvents ( ) : array
Результат array

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

public handleMessage ( MessageEvent $messageEvent )
$messageEvent Thruway\Event\MessageEvent

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

public handleNewRealm ( NewRealmEvent $newRealmEvent )
$newRealmEvent Thruway\Event\NewRealmEvent

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

Gets called when the module is initialized in the router
public initModule ( Thruway\Peer\RouterInterface $router, React\EventLoop\LoopInterface $loop )
$router Thruway\Peer\RouterInterface
$loop React\EventLoop\LoopInterface

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

actionMsg should be an instance of: register, call, subscribe, or publish messages
public isAuthorizedTo ( Session $session, Thruway\Message\ActionMessageInterface $actionMsg ) : boolean
$session Thruway\Session
$actionMsg Thruway\Message\ActionMessageInterface
Результат boolean

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

public isReady ( ) : boolean
Результат boolean

isValidAction() публичный статический Метод

public static isValidAction ( $action ) : boolean
$action
Результат boolean

isValidRuleUri() публичный статический Метод

public static isValidRuleUri ( $uri ) : boolean
$uri
Результат boolean

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

public onSessionStart ( ClientSession $session, Thruway\Transport\TransportInterface $transport )
$session Thruway\ClientSession
$transport Thruway\Transport\TransportInterface

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

public removeAuthorizationRule ( $args )
$args

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

public setReady ( boolean $ready )
$ready boolean

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

Arguments need to be [["role1", "role2"], "publish|subscribe|register|call", "my.uri"]
public testAuthorization ( $args ) : boolean | mixed
$args
Результат boolean | mixed