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

Set authenticate ID
public setAuthId ( string $authId )
$authId string
Пример #1
0
 /**
  * Constructor
  *
  * @param array $options
  * @param \React\EventLoop\LoopInterface $loop
  * @throws \Exception
  */
 public function __construct(array $options, LoopInterface $loop = null)
 {
     $this->options = $options;
     $this->client = new Client($options['realm'], $loop);
     $url = isset($options['url']) ? $options['url'] : null;
     $pawlTransport = new PawlTransportProvider($url);
     $this->client->addTransportProvider($pawlTransport);
     $this->client->setReconnectOptions($options);
     //Set Authid
     if (isset($options['authid'])) {
         $this->client->setAuthId($options['authid']);
     }
     //Register Handlers
     $this->handleOnChallenge();
     $this->handleOnOpen();
     $this->handleOnClose();
     $this->handleOnError();
 }
Пример #2
0
 /**
  * Constructor
  *
  * @param array $options
  * @param \React\EventLoop\LoopInterface $loop
  * @throws \Exception
  */
 public function __construct(array $options, LoopInterface $loop = null)
 {
     $this->options = $options;
     $this->client = new Client($options['realm'], $loop);
     $url = isset($options['url']) ? $options['url'] : null;
     $pawlTransport = new PawlTransportProvider($url);
     $this->client->addTransportProvider($pawlTransport);
     $this->client->setReconnectOptions($options);
     /*
      * Authentication on challenge callback
      */
     if (isset($options['onChallenge']) && is_callable($options['onChallenge']) && isset($options['authmethods']) && is_array($options['authmethods'])) {
         $this->client->setAuthMethods($options['authmethods']);
         $this->client->on('challenge', function (ClientSession $session, ChallengeMessage $msg) use($options) {
             $token = call_user_func_array($options['onChallenge'], [$session, $msg->getAuthMethod(), $msg]);
             $session->sendMessage(new AuthenticateMessage($token));
         });
     }
     //Set Authid
     if (isset($options['authid'])) {
         $this->client->setAuthId($options['authid']);
     }
     if (isset($this->options['onClose']) && is_callable($this->options['onClose'])) {
         $this->on('close', $this->options['onClose']);
     }
     /*
      * Handle On Open event
      *
      */
     $this->client->on('open', function (ClientSession $session, TransportInterface $transport) {
         $this->transport = $transport;
         $this->emit('open', [$session]);
     });
     /*
      * Handle On Close event
      */
     $this->client->on('close', function ($reason) {
         $this->emit('close', [$reason]);
     });
     $this->client->on('error', function ($reason) {
         $this->emit('error', [$reason]);
     });
 }