public static function init($path, $instancename = 'simplesaml', $configfilename = 'config.php')
{
assert('is_string($path)');
assert('is_string($instancename)');
assert('is_string($configfilename)');
if ($instancename === 'simplesaml') {
// for backwards compatibility
self::setConfigDir($path, 'simplesaml');
}
// check if we already have loaded the given config - return the existing instance if we have
if (array_key_exists($instancename, self::$instance)) {
return self::$instance[$instancename];
}
self::$instance[$instancename] = self::loadFromFile($path . '/' . $configfilename, true);
return self::$instance[$instancename];
}
/** * Default Constructor * * Instantiate an instance of the SimpleSAML_Auth_Simple class * and call requireAuth() to validate a user * * @param array $options Array of options to pass to the constructor * */ function __construct($options = array()) { // Auto load libraries and // obtain simple SAML SP configuration data $this->samlLib = $options["ssphp_lib"]; $this->samlConfig = $options["ssphp_config"]; require_once $this->samlLib . '/lib/_autoload.php'; SimpleSAML_Configuration::init($this->samlConfig); // You can specifically overide any of the default configuration options setup above if (count($options) > 0) { if (array_key_exists("ssphp_sp", $options)) { $this->ssphpSP = $options["ssphp_sp"]; } else { Log::Error("Could not connect to SAML service provider." . " Please check your SAML configuration settings"); } } $this->authSimple = new SimpleSAML_Auth_Simple($this->ssphpSP); // requireAuth() redirects user to SSO login page // where user needs to enter SSO username and password. // If user is not validated, then this function does not return $this->authSimple->requireAuth(); }