Beispiel #1
0
 public function testGetPostData()
 {
     $ortcConfig = new OrtcConfig();
     $ortcConfig->setApplicationKey('abcede');
     $ortcConfig->setPrivateKey('123456');
     $request = new AuthRequest();
     $request->setOrtcConfig($ortcConfig);
     $request->setAuthToken('wxyz123');
     $request->setExpireTime(3600);
     $request->setChannels([new Channel('channel1', 'r'), new Channel('channel2', 'w')]);
     $expected = ['AT' => 'wxyz123', 'PVT' => 0, 'AK' => 'abcede', 'TTL' => 3600, 'PK' => '123456', 'TP' => 2, 'channel1' => 'r', 'channel2' => 'w'];
     $this->assertEquals($expected, $request->getPostData());
 }
Beispiel #2
0
 /**
  * authenticate user.
  *
  * @param AuthRequest $authRequest
  *
  * @throws Exceptions\NetworkErrorException
  * @throws Exceptions\UnauthorizedException
  *
  * @return Models\Responses\AuthResponse
  */
 public function authenticate(AuthRequest $authRequest)
 {
     $this->prepare();
     $authRequest->setOrtcConfig($this->ortcConfig);
     $ortcClient = new OrtcClient();
     $ortcClient->setRequest($authRequest);
     $ortcClient->setGuzzleClient($this->guzzleClient);
     $ortcClient->setBaseUrl($this->baseUrl);
     return $ortcClient->execute();
 }