diff --git a/lib/SimpleSAML/AuthMemCookie.php b/lib/SimpleSAML/AuthMemCookie.php index 4a49edf5dcf645b799014e53698392c2429d4c0c..e15e0b9b46488a684a1cb11f8acf76ba90921f0e 100644 --- a/lib/SimpleSAML/AuthMemCookie.php +++ b/lib/SimpleSAML/AuthMemCookie.php @@ -47,10 +47,10 @@ class SimpleSAML_AuthMemCookie { /** * Retrieve the login method which should be used to authenticate the user. * - * @return The login type which should be used for Auth MemCookie. + * @return string The login type which should be used for Auth MemCookie. */ public function getLoginMethod() { - $loginMethod = $this->amcConfig->getValue('loginmethod', 'saml2'); + $loginMethod = $this->amcConfig->getString('loginmethod', 'saml2'); $supportedLogins = array( 'saml2', 'shib13', @@ -66,10 +66,10 @@ class SimpleSAML_AuthMemCookie { /** * This function retrieves the name of the cookie from the configuration. * - * @return The name of the cookie. + * @return string The name of the cookie. */ public function getCookieName() { - $cookieName = $this->amcConfig->getValue('cookiename', 'AuthMemCookie'); + $cookieName = $this->amcConfig->getString('cookiename', 'AuthMemCookie'); if(!is_string($cookieName) || strlen($cookieName) === 0) { throw new Exception('Configuration option \'cookiename\' contains an invalid value. This option should be a string.'); } @@ -81,13 +81,10 @@ class SimpleSAML_AuthMemCookie { /** * This function retrieves the name of the attribute which contains the username from the configuration. * - * @return The name of the attribute which contains the username. + * @return string The name of the attribute which contains the username. */ public function getUsernameAttr() { - $usernameAttr = $this->amcConfig->getValue('username'); - if($usernameAttr === NULL) { - throw new Exception('Missing required configuration option \'username\' in authmemcookie.php.'); - } + $usernameAttr = $this->amcConfig->getString('username', NULL); return $usernameAttr; } @@ -96,10 +93,10 @@ class SimpleSAML_AuthMemCookie { /** * This function retrieves the name of the attribute which contains the groups from the configuration. * - * @return The name of the attribute which contains the groups. + * @return string The name of the attribute which contains the groups. */ public function getGroupsAttr() { - $groupsAttr = $this->amcConfig->getValue('groups'); + $groupsAttr = $this->amcConfig->getString('groups', NULL); return $groupsAttr; } @@ -108,21 +105,12 @@ class SimpleSAML_AuthMemCookie { /** * This function creates and initializes a Memcache object from our configuration. * - * @return A Memcache object initialized from our configuration. + * @return Memcache A Memcache object initialized from our configuration. */ public function getMemcache() { - $memcacheHost = $this->amcConfig->getValue('memcache.host', '127.0.0.1'); - if(!is_string($memcacheHost)) { - throw new Exception('Invalid value of the \'memcache.host\' configuration option. This option' . - ' should be a string with a hostname or a string with an IP address.'); - } - - $memcachePort = $this->amcConfig->getValue('memcache.port', 11211); - if(!is_int($memcachePort)) { - throw new Exception('Invalid value of the \'memcache.port\' configuration option. This option' . - ' should be an integer.'); - } + $memcacheHost = $this->amcConfig->getString('memcache.host', '127.0.0.1'); + $memcachePort = $this->amcConfig->getInteger('memcache.port', 11211); $memcache = new Memcache;