Skip to content
Snippets Groups Projects
Commit f499612c authored by Olav Morken's avatar Olav Morken
Browse files

SimpleSAML_AuthMemCookie: Replace getValue(...) with more specific get-functions.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1676 44740490-163a-0410-bde0-09ae8108e29a
parent ad447b16
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment