PHP Class Thruway\Authentication\AuthenticationManager

Inheritance: extends Thruway\Module\RouterModuleClient, implements Thruway\Module\RealmModuleInterface
Exibir arquivo Open project: voryx/thruway

Public Methods

Method Description
__construct ( ) Constructor
getAuthMethods ( ) : array Get list supported authentication methods
getReady ( ) : boolean Get ready flag
getSubscribedEvents ( ) : array Listen for Router events
getSubscribedRealmEvents ( ) : array Listen for Realm events
handleAuthenticateMessage ( Realm $realm, Session $session, Thruway\Message\AuthenticateMessage $msg ) Handle Authenticate message
handleHelloMessage ( Realm $realm, Session $session, Thruway\Message\HelloMessage $msg ) Handle HelloMessage
handleMessageEvent ( MessageEvent $event )
handleNewRealm ( NewRealmEvent $event )
initModule ( Thruway\Peer\RouterInterface $router, React\EventLoop\LoopInterface $loop ) Gets called when the module is initialized in the router
onSessionClose ( Session $session ) This allows the AuthenticationManager to clean out auth methods that were registered by sessions that are dieing. Otherwise the method could be hijacked by another client in the thruway.auth realm.
onSessionStart ( ClientSession $session, Thruway\Transport\TransportProviderInterface $transport ) Handles session started
readyToAuthenticate ( ) : boolean Check ready to authenticate
registerAuthMethod ( array $args, array $kwargs, array $details ) : array This is called via a WAMP RPC URI. It is registered as thruway.auth.registermethod it takes arguments in an array - ["methodName", ["realm1", "realm2", "*"],
setReady ( boolean $ready ) Set ready flag

Private Methods

Method Description
abortSessionUsingResponse ( Session $session, $response ) : boolean Send an abort message to the session if the Authenticator sent a FAILURE response Returns true if the abort was sent, false otherwise
onAuthenticateHandler ( $authMethod, $authMethodInfo, Realm $realm, Session $session, Thruway\Message\AuthenticateMessage $msg ) Call the handler that was registered to handle the Authenticate Message
onHelloAuthHandler ( $authMethod, $authMethodInfo, Realm $realm, Session $session, Thruway\Message\HelloMessage $msg ) Call the RPC URI that has been registered to handle Authentication Hello Messages
processMessage ( Realm $realm, Session $session, Thruway\Message\Message $msg ) Handles all messages for authentication (Hello and Authenticate) This is called by the Realm to handle authentication
realmHasAuthProvider ( string $realmName ) : boolean Checks to see if a realm has a registered auth provider

Method Details

__construct() public method

Constructor
public __construct ( )

getAuthMethods() public method

Get list supported authentication methods
public getAuthMethods ( ) : array
return array

getReady() public method

Get ready flag
public getReady ( ) : boolean
return boolean

getSubscribedEvents() public static method

Listen for Router events
public static getSubscribedEvents ( ) : array
return array

getSubscribedRealmEvents() public method

Listen for Realm events
public getSubscribedRealmEvents ( ) : array
return array

handleAuthenticateMessage() public method

Handle Authenticate message
public handleAuthenticateMessage ( Realm $realm, Session $session, Thruway\Message\AuthenticateMessage $msg )
$realm Thruway\Realm
$session Thruway\Session
$msg Thruway\Message\AuthenticateMessage

handleHelloMessage() public method

Handle HelloMessage
public handleHelloMessage ( Realm $realm, Session $session, Thruway\Message\HelloMessage $msg )
$realm Thruway\Realm
$session Thruway\Session
$msg Thruway\Message\HelloMessage

handleMessageEvent() public method

public handleMessageEvent ( MessageEvent $event )
$event Thruway\Event\MessageEvent

handleNewRealm() public method

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

initModule() public method

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

onSessionClose() public method

This allows the AuthenticationManager to clean out auth methods that were registered by sessions that are dieing. Otherwise the method could be hijacked by another client in the thruway.auth realm.
public onSessionClose ( Session $session )
$session Thruway\Session

onSessionStart() public method

Handles session started
public onSessionStart ( ClientSession $session, Thruway\Transport\TransportProviderInterface $transport )
$session Thruway\ClientSession
$transport Thruway\Transport\TransportProviderInterface

readyToAuthenticate() public method

Check ready to authenticate
public readyToAuthenticate ( ) : boolean
return boolean

registerAuthMethod() public method

This is called via a WAMP RPC URI. It is registered as thruway.auth.registermethod it takes arguments in an array - ["methodName", ["realm1", "realm2", "*"],
public registerAuthMethod ( array $args, array $kwargs, array $details ) : array
$args array
$kwargs array
$details array
return array

setReady() public method

Set ready flag
public setReady ( boolean $ready )
$ready boolean