/** * Base constructor. * * @param string $serverName Name of the OAuth2 server in the current configuration. * @param string|array $roles Roles that will be set for the OAuth2 users. * * @throws OAuth2Exception */ public function __construct($serverName, $roles) { try { $this->oauth2Instance = OAuth2Loader::getInstance($serverName); $this->oauth2Roles = (array) $roles; } catch (\Exception $e) { throw new OAuth2Exception($e->getMessage()); } }
/** * @expectedException \Webiny\Component\OAuth2\OAuth2Exception * @expectedExceptionMessage Server missing */ public function testGetInstanceServerException() { OAuth2Loader::getInstance('GPlus'); }
public function dataProvider() { OAuth2::setConfig(realpath(__DIR__ . '/' . self::CONFIG)); Request::getInstance()->setCurrentUrl('http://admin.w3.com/batman-is-better-than-superman/?batman=one&superman=two'); $oauth2Instance = OAuth2Loader::getInstance('Facebook'); $oauth2Request = new OAuth2Request($oauth2Instance); return [[$oauth2Request]]; }