function __construct($person) { parent::__construct($person); $this->attributes = array(); $this->idp = ""; $personIndex = 0; try { $personIndex = (int) Config::get_config('bypass_id'); } catch (KeyNotFoundException $knfe) { Logger::log_event(LOG_NOTICE, __FILE__ . ":" . __LINE__ . " bypass_id not set in config. Using default ID."); } switch ($personIndex) { case 0: $this->attributes = array('cn2' => array('John Doe'), 'eduPersonPrincipalName' => array('*****@*****.**'), 'mail2' => array('*****@*****.**'), 'country' => array('NN'), 'organization' => array('o=Hogwarts, dc=hsww, dc=wiz'), 'nren' => array('testnren'), 'eduPersonEntitlement2' => array('urn:mace:feide.no:sigma.uninett.no:confusa')); $this->idp = "idp.example.org"; break; case 1: $this->attributes = array('cn2' => array('Jane Doe'), 'eduPersonPrincipalName' => array('*****@*****.**'), 'mail2' => array('*****@*****.**', '*****@*****.**', '*****@*****.**'), 'country' => array('NN'), 'organization' => array('o=Barad, dc=Dur'), 'nren' => array('testnren'), 'eduPersonEntitlement2' => array('urn:mace:feide.no:sigma.uninett.no:confusaAdmin', 'urn:mace:feide.no:sigma.uninett.no:confusa')); $this->idp = "idp.example.org"; break; case 2: default: $this->attributes = array('cn2' => array('Ola Nordmann'), 'eduPersonPrincipalName' => array('*****@*****.**', '*****@*****.**', '*****@*****.**'), 'mail2' => array('*****@*****.**'), 'country' => array('NO'), 'organization' => array('o=Hogwarts, dc=hsww, dc=wiz'), 'nren' => array('testnren'), 'eduPersonEntitlement2' => array('urn:mace:feide.no:sigma.uninett.no:confusa')); $this->idp = "idp.example.org"; break; } }
/** * Constructor * * Note that the person is tied to a session and a simplesaml configuration * here */ function __construct($person = NULL) { parent::__construct($person); /* Find the path to simpelsamlphp and run the autoloader */ try { $sspdir = Config::get_config('simplesaml_path'); } catch (KeyNotFoundException $knfe) { echo "Cannot find path to simplesaml. This install is not valid. Aborting.<br />\n"; Logger::logEvent(LOG_ALERT, "Confusa_Auth_IdP", "__construct()", "Trying to instantiate SimpleSAMLphp without a configured path."); exit(0); } require_once $sspdir . '/lib/_autoload.php'; SimpleSAML_Configuration::setConfigDir($sspdir . '/config'); /* start a session needed for the IdP-based AuthN approach */ $this->as = new SimpleSAML_Auth_Simple('default-sp'); $this->session = SimpleSAML_Session::getInstance(); }
/** * Constructor * * Note that the person is tied to a OAuth datastore here */ function __construct($person = NULL) { parent::__construct($person); /* Find the path to simpelsamlphp and run the autoloader */ try { $sspdir = Config::get_config('simplesaml_path'); } catch (KeyNotFoundException $knfe) { echo "Cannot find path to simplesaml. This install is not valid. Aborting.<br />\n"; Logger::log_event(LOG_ALERT, "Trying to instantiate simpleSAMLphp without a configured path."); exit(0); } require_once $sspdir . '/lib/_autoload.php'; SimpleSAML_Configuration::setConfigDir($sspdir . '/config'); $this->oauthStore = new OAuthDataStore_Confusa(); $this->oauthServer = new sspmod_oauth_OAuthServer($this->oauthStore); $hmac_method = new OAuthSignatureMethod_HMAC_SHA1(); $this->oauthServer->add_signature_method($hmac_method); $req = OAuthRequest::from_request(); list($consumer, $this->accessToken) = $this->oauthServer->verify_request($req); $this->isAuthenticated = isset($this->accessToken); }