PHP Class Thruway\Authentication\AuthorizationManager

Inheritance: extends Thruway\Peer\Client, implements Thruway\Authentication\AuthorizationManagerInterface
Afficher le fichier Open project: voryx/thruway

Méthodes publiques

Méthode Description
__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"]

Private Methods

Méthode Description
getRuleFromArgs ( $args ) : stdClass | boolean
isAuthorizedByRolesActionAndUri ( $rolesToCheck, $action, $uri ) : boolean | mixed

Method Details

__construct() public méthode

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

addAuthorizationRule() public méthode

Should be $args[0]
public addAuthorizationRule ( $args ) : string
$args
Résultat string

flushAuthorizationRules() public méthode

public flushAuthorizationRules ( boolean $allowByDefault = false ) : string
$allowByDefault boolean
Résultat string

getAuthorizationRules() public méthode

public getAuthorizationRules ( ) : Result
Résultat Thruway\Result

getSubscribedEvents() public static méthode

Listen for Router events
public static getSubscribedEvents ( ) : array
Résultat array

getSubscribedRealmEvents() public méthode

public getSubscribedRealmEvents ( ) : array
Résultat array

handleMessage() public méthode

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

handleNewRealm() public méthode

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

initModule() public méthode

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() public méthode

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
Résultat boolean

isReady() public méthode

public isReady ( ) : boolean
Résultat boolean

isValidAction() public static méthode

public static isValidAction ( $action ) : boolean
$action
Résultat boolean

isValidRuleUri() public static méthode

public static isValidRuleUri ( $uri ) : boolean
$uri
Résultat boolean

onSessionStart() public méthode

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

removeAuthorizationRule() public méthode

public removeAuthorizationRule ( $args )
$args

setReady() public méthode

public setReady ( boolean $ready )
$ready boolean

testAuthorization() public méthode

Arguments need to be [["role1", "role2"], "publish|subscribe|register|call", "my.uri"]
public testAuthorization ( $args ) : boolean | mixed
$args
Résultat boolean | mixed