Example #1
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info Information about this authentication source.
  * @param array $config The configuration of the module
  *
  * @throws Exception If the KRB5 extension is not installed or active.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     if (!extension_loaded('krb5')) {
         throw new Exception('KRB5 Extension not installed');
     }
     // call the parent constructor first, as required by the interface
     parent::__construct($info, $config);
     $config = SimpleSAML_Configuration::loadFromArray($config);
     $this->backend = $config->getString('fallback');
     $this->hostname = $config->getString('hostname');
     $this->port = $config->getInteger('port', 389);
     $this->referrals = $config->getBoolean('referrals', true);
     $this->enableTLS = $config->getBoolean('enable_tls', false);
     $this->debugLDAP = $config->getBoolean('debugLDAP', false);
     $this->timeout = $config->getInteger('timeout', 30);
     $this->keytab = $config->getString('keytab');
     $this->base = $config->getArrayizeString('base');
     $this->attr = $config->getString('attr', 'uid');
     $this->subnet = $config->getArray('subnet', null);
     $this->admin_user = $config->getString('adminUser', null);
     $this->admin_pw = $config->getString('adminPassword', null);
     $this->attributes = $config->getArray('attributes', null);
 }
Example #2
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     if (!array_key_exists('serverurl', $config)) {
         throw new Exception('aselect serverurl not specified');
     }
     $this->asconfig['serverurl'] = $config['serverurl'];
     if (!array_key_exists('serverid', $config)) {
         throw new Exception('aselect serverid not specified');
     }
     $this->asconfig['serverid'] = $config['serverid'];
     if (!array_key_exists('type', $config)) {
         throw new Exception('aselect type not specified');
     }
     $this->asconfig['type'] = $config['type'];
     if ($this->asconfig['type'] == 'app') {
         if (!array_key_exists('app_id', $config)) {
             throw new Exception('aselect app_id not specified');
         }
         $this->asconfig['app_id'] = $config['app_id'];
     } elseif ($this->asconfig['type'] == 'cross') {
         if (!array_key_exists('local_organization', $config)) {
             throw new Exception('aselect local_organization not specified');
         }
         $this->asconfig['local_organization'] = $config['local_organization'];
         $this->asconfig['required_level'] = array_key_exists('required_level', $config) ? $config['required_level'] : 10;
     } else {
         throw new Exception('aselect type need to be either app or cross');
     }
 }
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
 }
Example #4
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     if (!array_key_exists('cas', $config)) {
         throw new Exception('cas authentication source is not properly configured: missing [cas]');
     }
     if (!array_key_exists('ldap', $config)) {
         throw new Exception('ldap authentication source is not properly configured: missing [ldap]');
     }
     $this->_casConfig = $config['cas'];
     $this->_ldapConfig = $config['ldap'];
     if (isset($this->_casConfig['serviceValidate'])) {
         $this->_validationMethod = 'serviceValidate';
     } elseif (isset($this->_casConfig['validate'])) {
         $this->_validationMethod = 'validate';
     } else {
         throw new Exception("validate or serviceValidate not specified");
     }
     if (isset($this->_casConfig['login'])) {
         $this->_loginMethod = $this->_casConfig['login'];
     } else {
         throw new Exception("cas login url not specified");
     }
 }
Example #5
0
 /**
  * Constructor for Google authentication source.
  *
  * @param array $info Information about this authentication source.
  * @param array $config Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     if (!array_key_exists('key', $config)) {
         throw new Exception('Google authentication source is not properly configured: missing [key]');
     }
     $this->key = $config['key'];
     if (!array_key_exists('secret', $config)) {
         throw new Exception('Google authentication source is not properly configured: missing [secret]');
     }
     $this->secret = $config['secret'];
     $this->linkback = SimpleSAML_Module::getModuleURL('authgoogleOIDC') . '/linkback.php';
     // Create Client
     $this->client = new Google_Client();
     $this->client->setApplicationName('Google gateway');
     $this->client->setClientId($this->key);
     $this->client->setClientSecret($this->secret);
     $this->client->setRedirectUri($this->linkback);
     $this->client->addScope('openid');
     $this->client->addScope('profile');
     $this->client->addScope('email');
 }
Example #6
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     // Call the parent constructor first, as required by the interface
     parent::__construct($info, $config);
     // Do any other configuration we need here
 }
 /**
  * Constructor for this authentication source.
  *
  * All subclasses who implement their own constructor must call this constructor before
  * using $config for anything.
  *
  * @param array $info  Information about this authentication source.
  * @param array &$config  Configuration for this authentication source.
  */
 public function __construct($info, &$config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     $this->usernameOrgMethod = 'none';
 }
Example #8
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     $this->userPassSource = $config['userPassSource'];
 }
Example #9
0
 /**
  * Constructor for this authentication source.
  *
  * All subclasses who implement their own constructor must call this constructor before
  * using $config for anything.
  *
  * @param array $info  Information about this authentication source.
  * @param array &$config  Configuration for this authentication source.
  */
 public function __construct($info, &$config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     if (isset($config['core:loginpage_links'])) {
         $this->loginLinks = $config['core:loginpage_links'];
     }
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
 }
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     $this->clientId = $config['client_id'];
     $this->clientSecret = $config['client_secret'];
     $this->tokenEndpoint = $config['token_endpoint'];
     $this->userInfoEndpoint = $config['user_info_endpoint'];
     $this->authEndpoint = $config['auth_endpoint'];
     $this->sslcapath = $config['sslcapath'];
 }
Example #11
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info	 Information about this authentication source.
  * @param array $config	 Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     if (!array_key_exists('sources', $config)) {
         throw new Exception('The required "sources" config option was not found');
     }
     $this->sources = $config['sources'];
 }
Example #12
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     $configObject = SimpleSAML_Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, TRUE) . ']');
     $this->key = $configObject->getString('key');
     $this->secret = $configObject->getString('secret');
     $this->force_login = $configObject->getBoolean('force_login', FALSE);
 }
Example #13
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     $cfgParse = SimpleSAML_Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, TRUE) . ']');
     $this->api_key = $cfgParse->getString('api_key');
     $this->secret = $cfgParse->getString('secret');
     $this->req_perms = $cfgParse->getString('req_perms', NULL);
 }
Example #14
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info   Information about this authentication source.
  * @param array $config Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     if (!array_key_exists('uid', $config) || !is_string($config['uid'])) {
         throw new SimpleSAML_Error_Exception("AA configuration error, 'uid' not found or not a string.");
     }
     SimpleSAML_Logger::debug('[aa] auth source Bypass: config uid: ' . $config['uid']);
     $this->uid = $config['uid'];
 }
Example #15
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     $cfgParse = SimpleSAML_Configuration::loadFromArray($config, 'Authentication source ' . var_export($this->authId, TRUE));
     $this->target = $cfgParse->getString('target', NULL);
     $this->realm = $cfgParse->getString('realm', NULL);
     $this->optionalAttributes = $cfgParse->getArray('attributes.optional', array());
     $this->requiredAttributes = $cfgParse->getArray('attributes.required', array());
     $this->optionalAXAttributes = $cfgParse->getArray('attributes.ax_optional', array());
     $this->requiredAXAttributes = $cfgParse->getArray('attributes.ax_required', array());
     $this->validateSReg = $cfgParse->getBoolean('sreg.validate', TRUE);
 }
Example #16
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     // Call the parent constructor first, as required by the interface
     parent::__construct($info, $config);
     if (array_key_exists('id', $config)) {
         $this->yubi_id = $config['id'];
     }
     if (array_key_exists('key', $config)) {
         $this->yubi_key = $config['key'];
     }
 }
Example #17
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     /* Parse attributes. */
     try {
         $this->attributes = SimpleSAML\Utils\Arrays::normalizeAttributesArray($config);
     } catch (Exception $e) {
         throw new Exception('Invalid attributes for authentication source ' . $this->authId . ': ' . $e->getMessage());
     }
 }
Example #18
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     if (!array_key_exists('site', $config)) {
         throw new Exception('PAPI authentication source is not properly configured: missing [site]');
     }
     $this->_poa = new PoA($config['site']);
     if (array_key_exists('hli', $config)) {
         $this->_hli = $config['hli'];
     }
 }
Example #19
0
 /**
  * Constructor for this authentication source.
  *
  * All subclasses who implement their own constructor must call this
  * constructor before using $config for anything.
  *
  * @param array $info  Information about this authentication source.
  * @param array &$config  Configuration for this authentication source.
  */
 public function __construct($info, &$config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     if (isset($config['authX509:x509attributes'])) {
         $this->x509attributes = $config['authX509:x509attributes'];
     }
     if (array_key_exists('authX509:ldapusercert', $config)) {
         $this->ldapusercert = $config['authX509:ldapusercert'];
     }
     parent::__construct($info, $config);
     $this->ldapcf = new sspmod_ldap_ConfigHelper($config, 'Authentication source ' . var_export($this->authId, TRUE));
     return;
 }
Example #20
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     // Call the parent constructor first, as required by the interface
     parent::__construct($info, $config);
     if (!array_key_exists('key', $config)) {
         throw new Exception('LinkedIn authentication source is not properly configured: missing [key]');
     }
     $this->key = $config['key'];
     if (!array_key_exists('secret', $config)) {
         throw new Exception('LinkedIn authentication source is not properly configured: missing [secret]');
     }
     $this->secret = $config['secret'];
 }
Example #21
0
 /**
  * Constructor for SAML SP authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     if (!isset($config['entityID'])) {
         $config['entityID'] = $this->getMetadataURL();
     }
     /* For compatibility with code that assumes that $metadata->getString('entityid') gives the entity id. */
     $config['entityid'] = $config['entityID'];
     $this->metadata = SimpleSAML_Configuration::loadFromArray($config, 'authsources[' . var_export($this->authId, TRUE) . ']');
     $this->entityId = $this->metadata->getString('entityID');
     $this->idp = $this->metadata->getString('idp', NULL);
     $this->discoURL = $this->metadata->getString('discoURL', NULL);
 }
Example #22
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     if (!array_key_exists('key', $config)) {
         throw new Exception('Twitter authentication source is not properly configured: missing [key]');
     }
     $this->key = $config['key'];
     if (!array_key_exists('secret', $config)) {
         throw new Exception('Twitter authentication source is not properly configured: missing [secret]');
     }
     $this->secret = $config['secret'];
     // require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/extlibinc/facebook.php');
 }
Example #23
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     if (!array_key_exists('key', $config)) {
         throw new Exception('Bnet authentication source is not properly configured: missing [key]');
     }
     $this->key = $config['key'];
     if (!array_key_exists('secret', $config)) {
         throw new Exception('Bnet authentication source is not properly configured: missing [secret]');
     }
     $this->secret = $config['secret'];
     $this->linkback = SimpleSAML_Module::getModuleURL('authbnet') . '/linkback.php';
 }
Example #24
0
	/**
	 * Constructor for this authentication source.
	 *
	 * @param array $info	 Information about this authentication source.
	 * @param array $config	 Configuration.
	 */
	public function __construct($info, $config) {
		assert('is_array($info)');
		assert('is_array($config)');

		/* Call the parent constructor first, as required by the interface. */
		parent::__construct($info, $config);

		if (!array_key_exists('sources', $config)) {
			throw new Exception('The required "sources" config option was not found');
		}

		$globalConfiguration = SimpleSAML_Configuration::getInstance();
		$defaultLanguage = $globalConfiguration->getString('language.default', 'en');
		$authsources = SimpleSAML_Configuration::getConfig('authsources.php');
		$this->sources = array();
		foreach($config['sources'] as $source => $info) {

			if (is_int($source)) { // Backwards compatibility 
				$source = $info;
				$info = array();
			}

			if (array_key_exists('text', $info)) {
				$text = $info['text'];
			} else {
				$text = array($defaultLanguage => $source);
			}

			if (array_key_exists('css-class', $info)) {
				$css_class = $info['css-class'];
			} else {
				/* Use the authtype as the css class */
				$authconfig = $authsources->getArray($source, NULL);
				if (!array_key_exists(0, $authconfig) || !is_string($authconfig[0])) {
					$css_class = "";
				} else {
					$css_class = str_replace(":", "-", $authconfig[0]);
				}
			}

			$this->sources[] = array(
				'source' => $source,
				'text' => $text,
				'css_class' => $css_class,
			);
		}
	}
 /**
  * Constructor for this authentication source.
  *
  * All subclasses who implement their own constructor must call this constructor before
  * using $config for anything.
  *
  * @param array $info  Information about this authentication source.
  * @param array &$config  Configuration for this authentication source.
  */
 public function __construct($info, &$config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     // Call the parent constructor first, as required by the interface
     parent::__construct($info, $config);
     // Get the remember username config options
     if (isset($config['remember.username.enabled'])) {
         $this->rememberUsernameEnabled = (bool) $config['remember.username.enabled'];
         unset($config['remember.username.enabled']);
     }
     if (isset($config['remember.username.checked'])) {
         $this->rememberUsernameChecked = (bool) $config['remember.username.checked'];
         unset($config['remember.username.checked']);
     }
     $this->usernameOrgMethod = 'none';
 }
 /**
  * Constructor for this authentication source.
  *
  * All subclasses who implement their own constructor must call this constructor before
  * using $config for anything.
  *
  * @param array $info  Information about this authentication source.
  * @param array &$config  Configuration for this authentication source.
  */
 public function __construct($info, &$config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     if (isset($config['core:loginpage_links'])) {
         $this->loginLinks = $config['core:loginpage_links'];
     }
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     // Get the remember username config options
     if (isset($config['remember.username.enabled'])) {
         $this->rememberUsernameEnabled = (bool) $config['remember.username.enabled'];
         unset($config['remember.username.enabled']);
     }
     if (isset($config['remember.username.checked'])) {
         $this->rememberUsernameChecked = (bool) $config['remember.username.checked'];
         unset($config['remember.username.checked']);
     }
 }
Example #27
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     $cfg = SimpleSAML_Configuration::loadFromArray($config, 'Authentication source ' . var_export($this->authId, true));
     $cfg->getValueValidate('type', array('app'), 'app');
     $this->app_id = $cfg->getString('app_id');
     $this->private_key = $cfg->getString('private_key', null);
     // accept these arguments with '_' for consistency
     // accept these arguments without '_' for backwards compatibility
     $this->server_id = $cfg->getString('serverid', null);
     if ($this->server_id === null) {
         $this->server_id = $cfg->getString('server_id');
     }
     $this->server_url = $cfg->getString('serverurl', null);
     if ($this->server_url === null) {
         $this->server_url = $cfg->getString('server_url');
     }
 }
Example #28
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     if (!array_key_exists('key', $config)) {
         throw new Exception('Google authentication source is not properly configured: missing [key]');
     }
     $this->key = $config['key'];
     if (!array_key_exists('secret', $config)) {
         throw new Exception('Google authentication source is not properly configured: missing [secret]');
     }
     $this->secret = $config['secret'];
     $this->linkback = SimpleSAML_Module::getModuleURL('authgoogle') . '/linkback.php';
     // Google Discovery Document
     /*$dd = 'https://accounts.google.com/.well-known/openid-configuration';
     		$xmlddresponse =  $this->curl_file_get_contents($dd);
     		SimpleSAML_Logger::debug('Google Response: '.$xmlddresponse);*/
 }
Example #29
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     // Call the parent constructor first, as required by the interface
     parent::__construct($info, $config);
     if (!array_key_exists('key', $config)) {
         throw new Exception('LinkedIn authentication source is not properly configured: missing [key]');
     }
     $this->key = $config['key'];
     if (!array_key_exists('secret', $config)) {
         throw new Exception('LinkedIn authentication source is not properly configured: missing [secret]');
     }
     $this->secret = $config['secret'];
     if (array_key_exists('attributes', $config)) {
         $this->attributes = $config['attributes'];
     } else {
         // Default values if the attributes are not set in config (ref https://developer.linkedin.com/docs/fields)
         $this->attributes = 'id,first-name,last-name,headline,summary,specialties,picture-url,email-address';
     }
 }
 /**
  * Constructor for this authentication source.
  *
  * @param array $info Information about this authentication source.
  * @param array $config The configuration of the module
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     parent::__construct($info, $config);
     $config = SimpleSAML_Configuration::loadFromArray($config);
     $this->ldap_hostname = $config->getString('ldap.hostname');
     $this->ldap_port = $config->getString('ldap.port', 389);
     $this->ldap_timeout = $config->getString('ldap.timeout', 10);
     $this->ldap_enableTLS = $config->getString('ldap.enableTLS', false);
     $this->ldap_debug = $config->getString('ldap.debug', false);
     $this->ldap_referrals = $config->getString('ldap.referrals', true);
     $this->ldap_admin_user = $config->getString('ldap.admin_user', null);
     $this->ldap_admin_password = $config->getString('ldap.admin_password', null);
     $this->ldap_base = $config->getArrayizeString('ldap.base');
     $this->ldap_identifier = $config->getString('ldap.identifier');
     $this->attributes = $config->getArrayizeString('attributes', null);
     $this->subnets = $config->getArrayizeString('subnets', null);
     $this->subnets_exclude = $config->getArrayizeString('subnets_exclude', null);
     $this->auth_fallback = $config->getString('auth_fallback');
 }