/** * This function is used to retrieve the singleton instance of this class. * * @return The singleton instance of this class. */ public static function getInstance() { if (self::$instance === NULL) { self::$instance = new SimpleSAML_AuthMemCookie(); } return self::$instance; }
* * The file extra/auth_memcookie.conf contains an example of how Auth Memcookie can be configured * to use SimpleSAMLphp. * * @deprecated This file has been deprecated and will be removed in SSP 2.0. Use the memcookie module instead. */ require_once '_include.php'; try { // load SimpleSAMLphp configuration $globalConfig = SimpleSAML_Configuration::getInstance(); // check if this module is enabled if (!$globalConfig->getBoolean('enable.authmemcookie', false)) { throw new SimpleSAML_Error_Error('NOACCESS'); } // load Auth MemCookie configuration $amc = SimpleSAML_AuthMemCookie::getInstance(); $sourceId = $amc->getAuthSource(); $s = new SimpleSAML_Auth_Simple($sourceId); // check if the user is authorized. We attempt to authenticate the user if not $s->requireAuth(); // generate session id and save it in a cookie $sessionID = SimpleSAML\Utils\Random::generateID(); $cookieName = $amc->getCookieName(); $sessionHandler = SimpleSAML_SessionHandler::getSessionHandler(); $sessionHandler->setCookie($cookieName, $sessionID); // generate the authentication information $attributes = $s->getAttributes(); $authData = array(); // username $usernameAttr = $amc->getUsernameAttr(); if (!array_key_exists($usernameAttr, $attributes)) {