engine = $engine; $this->userConfigManager = $userConfigManager; $this->code = $code; $this->name = $name; $this->configureAction = $configureAction; $this->authAction = $authAction; $this->extraActions = $extraActions; $this->canReset = $canReset; $this->icon = $icon; } /** * Return true if this provider has been enabled by admin * @return boolean */ public function isEnabled() { return $this->getEngine()->isEnabled(); } /** * Get provider engine * @return EngineInterface */ public function getEngine() { return $this->engine; } /** * Get provider code * @return string */ public function getCode() { return $this->code; } /** * Get provider name * @return string */ public function getName() { return $this->name; } /** * Get provider icon * @return string */ public function getIcon() { return $this->icon; } /** * Return true if this provider configuration can be reset * @return boolean */ public function isResetAllowed() { return $this->canReset; } /** * Return true if this provider allows trusted devices * @return boolean */ public function isTrustedDevicesAllowed() { return $this->engine->isTrustedDevicesAllowed(); } /** * @inheritdoc */ public function resetConfiguration($userId) { $this->userConfigManager->setProviderConfig($userId, $this->getCode(), null); return $this; } /** * @inheritdoc */ public function isConfigured($userId) { return $this->getConfiguration($userId) !== null; } /** * @inheritdoc */ public function getConfiguration($userId) { return $this->userConfigManager->getProviderConfig($userId, $this->getCode()); } /** * @inheritdoc */ public function isActive($userId) { return $this->userConfigManager->isProviderConfigurationActive($userId, $this->getCode()); } /** * @inheritdoc */ public function activate($userId) { $this->userConfigManager->activateProviderConfiguration($userId, $this->getCode()); return $this; } /** * Get configure action * @return string */ public function getConfigureAction() { return $this->configureAction; } /** * Get auth action * @return string */ public function getAuthAction() { return $this->authAction; } /** * Get allowed extra actions * @return string[] */ public function getExtraActions() { return $this->extraActions; } }