public function testVkontakteConstruction() { $clientData = ['Vkontakte' => ['clientId' => '4640662', 'clientSecret' => 'Cv8uxCxnjIAooK7dyDwp']]; $factory = new ClientFactory('Vkontakte', $clientData); $client = $factory->make(); $clientTypeExpected = 'kolyunya\\oauth2\\validation\\clients\\VkontakteClient'; $clientType = get_class($client); $this->assertEquals($clientTypeExpected, $clientType); }
public function beforeAction($action) { $clientFactory = new ClientFactory($this->clientName, $this->clientsData); $client = $clientFactory->make(); $authenticated = $client->validate($this->userId, $this->userToken); if ($authenticated === true) { return true; } else { throw new UnauthorizedHttpException(); } }