PHP 클래스 Thruway\Authentication\AuthorizationManager

상속: extends Thruway\Peer\Client, implements Thruway\Authentication\AuthorizationManagerInterface
파일 보기 프로젝트 열기: voryx/thruway

공개 메소드들

메소드 설명
__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