ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SimpleSAML_AuthMemCookie Class Reference
+ Collaboration diagram for SimpleSAML_AuthMemCookie:

Public Member Functions

 getAuthSource ()
 Retrieve the authentication source that should be used to authenticate the user. More...
 
 getCookieName ()
 This function retrieves the name of the cookie from the configuration. More...
 
 getUsernameAttr ()
 This function retrieves the name of the attribute which contains the username from the configuration. More...
 
 getGroupsAttr ()
 This function retrieves the name of the attribute which contains the groups from the configuration. More...
 
 getMemcache ()
 This function creates and initializes a Memcache object from our configuration. More...
 

Static Public Member Functions

static getInstance ()
 This function is used to retrieve the singleton instance of this class. More...
 
static logoutHandler ()
 This function implements the logout handler. More...
 

Private Member Functions

 __construct ()
 This function implements the constructor for this class. More...
 
 doLogout ()
 This function logs the user out by deleting the session information from memcache. More...
 

Private Attributes

 $amcConfig
 

Static Private Attributes

static $instance = null
 

Detailed Description

Definition at line 13 of file AuthMemCookie.php.

Constructor & Destructor Documentation

◆ __construct()

SimpleSAML_AuthMemCookie::__construct ( )
private

This function implements the constructor for this class.

It loads the Auth MemCookie configuration.

Definition at line 46 of file AuthMemCookie.php.

47 {
48 // load AuthMemCookie configuration
49 $this->amcConfig = SimpleSAML_Configuration::getConfig('authmemcookie.php');
50 }
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.

References SimpleSAML_Configuration\getConfig().

+ Here is the call graph for this function:

Member Function Documentation

◆ doLogout()

SimpleSAML_AuthMemCookie::doLogout ( )
private

This function logs the user out by deleting the session information from memcache.

Definition at line 139 of file AuthMemCookie.php.

140 {
141 $cookieName = $this->getCookieName();
142
143 // check if we have a valid cookie
144 if (!array_key_exists($cookieName, $_COOKIE)) {
145 return;
146 }
147
149
150 // delete the session from memcache
151 $memcache = $this->getMemcache();
152 $memcache->delete($sessionID);
153
154 // delete the session cookie
156 }
$_COOKIE['client_id']
Definition: server.php:9
static setCookie($name, $value, $params=null, $throw=true)
Set a cookie.
Definition: HTTP.php:1107
getMemcache()
This function creates and initializes a Memcache object from our configuration.
getCookieName()
This function retrieves the name of the cookie from the configuration.
$cookieName
foreach($authData as $name=> $values) $memcache
$sessionID

References $_COOKIE, $cookieName, $memcache, $sessionID, getCookieName(), getMemcache(), and SimpleSAML\Utils\HTTP\setCookie().

+ Here is the call graph for this function:

◆ getAuthSource()

SimpleSAML_AuthMemCookie::getAuthSource ( )

Retrieve the authentication source that should be used to authenticate the user.

Returns
string The login type which should be used for Auth MemCookie.

Definition at line 58 of file AuthMemCookie.php.

59 {
60 return $this->amcConfig->getString('authsource');
61 }

◆ getCookieName()

SimpleSAML_AuthMemCookie::getCookieName ( )

This function retrieves the name of the cookie from the configuration.

Returns
string The name of the cookie.
Exceptions
ExceptionIf the value of the 'cookiename' configuration option is invalid.

Definition at line 70 of file AuthMemCookie.php.

71 {
72 $cookieName = $this->amcConfig->getString('cookiename', 'AuthMemCookie');
73 if (!is_string($cookieName) || strlen($cookieName) === 0) {
74 throw new Exception(
75 "Configuration option 'cookiename' contains an invalid value. This option should be a string."
76 );
77 }
78
79 return $cookieName;
80 }

References $cookieName.

Referenced by doLogout().

+ Here is the caller graph for this function:

◆ getGroupsAttr()

SimpleSAML_AuthMemCookie::getGroupsAttr ( )

This function retrieves the name of the attribute which contains the groups from the configuration.

Returns
string The name of the attribute which contains the groups.

Definition at line 101 of file AuthMemCookie.php.

102 {
103 $groupsAttr = $this->amcConfig->getString('groups', null);
104
105 return $groupsAttr;
106 }
$groupsAttr

References $groupsAttr.

◆ getInstance()

static SimpleSAML_AuthMemCookie::getInstance ( )
static

This function is used to retrieve the singleton instance of this class.

Returns
SimpleSAML_AuthMemCookie The singleton instance of this class.

Definition at line 33 of file AuthMemCookie.php.

34 {
35 if (self::$instance === null) {
36 self::$instance = new SimpleSAML_AuthMemCookie();
37 }
38
39 return self::$instance;
40 }

References $instance.

Referenced by logoutHandler().

+ Here is the caller graph for this function:

◆ getMemcache()

SimpleSAML_AuthMemCookie::getMemcache ( )

This function creates and initializes a Memcache object from our configuration.

Returns
Memcache A Memcache object initialized from our configuration.
Exceptions
ExceptionIf the servers configuration is invalid.

Definition at line 115 of file AuthMemCookie.php.

116 {
117 $memcacheHost = $this->amcConfig->getString('memcache.host', '127.0.0.1');
118 $memcachePort = $this->amcConfig->getInteger('memcache.port', 11211);
119
120 $class = class_exists('Memcache') ? 'Memcache' : (class_exists('Memcached') ? 'Memcached' : FALSE);
121 if (!$class) {
122 throw new Exception('Missing Memcached implementation. You must install either the Memcache or Memcached extension.');
123 }
124
125 // Create the Memcache(d) object.
126 $memcache = new $class();
127
128 foreach (explode(',', $memcacheHost) as $memcacheHost) {
129 $memcache->addServer($memcacheHost, $memcachePort);
130 }
131
132 return $memcache;
133 }

References $memcache.

Referenced by doLogout().

+ Here is the caller graph for this function:

◆ getUsernameAttr()

SimpleSAML_AuthMemCookie::getUsernameAttr ( )

This function retrieves the name of the attribute which contains the username from the configuration.

Returns
string The name of the attribute which contains the username.

Definition at line 88 of file AuthMemCookie.php.

89 {
90 $usernameAttr = $this->amcConfig->getString('username', null);
91
92 return $usernameAttr;
93 }
$usernameAttr

References $usernameAttr.

◆ logoutHandler()

static SimpleSAML_AuthMemCookie::logoutHandler ( )
static

This function implements the logout handler.

It deletes the information from Memcache.

Definition at line 162 of file AuthMemCookie.php.

163 {
164 self::getInstance()->doLogout();
165 }
static getInstance()
This function is used to retrieve the singleton instance of this class.

References getInstance().

+ Here is the call graph for this function:

Field Documentation

◆ $amcConfig

SimpleSAML_AuthMemCookie::$amcConfig
private

Definition at line 25 of file AuthMemCookie.php.

◆ $instance

SimpleSAML_AuthMemCookie::$instance = null
staticprivate

Definition at line 19 of file AuthMemCookie.php.

Referenced by getInstance().


The documentation for this class was generated from the following file: