ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilPDOAuthentication Class Reference
+ Inheritance diagram for ilPDOAuthentication:
+ Collaboration diagram for ilPDOAuthentication:

Public Member Functions

 __construct ()
 
 setIdle ($time, $add=false)
 Set maximum idle time. More...
 
 setExpire ($time, $add=false)
 Set the maximum expire time. More...
 
 start ()
 Start new auth session. More...
 
 getAuth ()
 Has the user been authenticated? More...
 
 getStatus ()
 
 getUsername ()
 
 sessionValidThru ()
 Returns the time up to the session is valid. More...
 
 logout ()
 
 setIdle ($time, $add=false)
 Set maximum idle time. More...
 
 setExpire ($time, $add=false)
 Set the maximum expire time. More...
 
 start ()
 Start new auth session. More...
 
 getAuth ()
 Has the user been authenticated? More...
 
 getStatus ()
 
 getUsername ()
 
 sessionValidThru ()
 Returns the time up to the session is valid. More...
 
 logout ()
 

Protected Member Functions

 checkAuth ()
 
 login ()
 
 assignData ()
 

Protected Attributes

 $_sessionName = '_authsession'
 
 $allowLogin = true
 
 $_postUsername = 'username'
 
 $_postPassword = 'password'
 
 $advancedsecurity
 
 $enableLogging
 
 $regenerateSessionId
 
 $status = ''
 
 $username = null
 
 $password
 
 $session
 
 $server
 
 $post
 
 $cookie
 

Private Member Functions

 setAuth ($username)
 

Detailed Description

Definition at line 8 of file class.ilPDOAuthentication.php.

Constructor & Destructor Documentation

◆ __construct()

ilPDOAuthentication::__construct ( )

Definition at line 26 of file class.ilPDOAuthentication.php.

26 {
27 // $started = session_start();
28 // $sess = session_id();
29 // $db_session_handler = new ilSessionDBHandler();
30 // if (!$db_session_handler->setSaveHandler())
31 // {
32 // throw new Exception("Disable save mode or set session_hanlder to \"user\"");
33 // }
34 @session_start(); // Due to UnitTests we have to silence this...
35
36 $this->session = $_SESSION[$this->_sessionName];
37 $this->server = $_SERVER;
38 $this->post = $_POST;
39 $this->cookie = $_COOKIE;
40 }
$_COOKIE['ilClientId']
Definition: BPMN2Parser.php:15
$_POST["username"]
$_SESSION["AccountId"]
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_COOKIE, $_POST, $_SERVER, $_SESSION, and $_sessionName.

Member Function Documentation

◆ assignData()

ilPDOAuthentication::assignData ( )
protected

Definition at line 133 of file class.ilPDOAuthentication.php.

133 {
134 if (isset($this->post[$this->_postUsername])
135 && $this->post[$this->_postUsername] != ''
136 ) {
137 $this->username = (get_magic_quotes_gpc() == 1 ? stripslashes($this->post[$this->_postUsername]) : $this->post[$this->_postUsername]);
138 }
139 if (isset($this->post[$this->_postPassword])
140 && $this->post[$this->_postPassword] != ''
141 ) {
142 $this->password = (get_magic_quotes_gpc() == 1 ? stripslashes($this->post[$this->_postPassword]) : $this->post[$this->_postPassword]);
143 }
144 }

References $_postPassword, and $_postUsername.

Referenced by start().

+ Here is the caller graph for this function:

◆ checkAuth()

ilPDOAuthentication::checkAuth ( )
protected
Returns
bool

Definition at line 75 of file class.ilPDOAuthentication.php.

75 {
76 return isset($_SESSION['_authsession']['username']);
77 }

References $_SESSION.

Referenced by getAuth(), and start().

+ Here is the caller graph for this function:

◆ getAuth()

ilPDOAuthentication::getAuth ( )

Has the user been authenticated?

Is there a valid login session. Previously this was different from checkAuth() but now it is just an alias.

Returns
bool True if the user is logged in, otherwise false.

Implements ilAuthPDOInterface.

Definition at line 97 of file class.ilPDOAuthentication.php.

97 {
98 return $this->checkAuth();
99 }

References checkAuth().

+ Here is the call graph for this function:

◆ getStatus()

ilPDOAuthentication::getStatus ( )
Returns
string

Implements ilAuthPDOInterface.

Definition at line 105 of file class.ilPDOAuthentication.php.

References $status.

◆ getUsername()

ilPDOAuthentication::getUsername ( )
Returns
string

Implements ilAuthPDOInterface.

Definition at line 113 of file class.ilPDOAuthentication.php.

113 {
114 return $_SESSION['_authsession']['username'];
115 }

References $_SESSION.

◆ login()

ilPDOAuthentication::login ( )
protected

Definition at line 80 of file class.ilPDOAuthentication.php.

80 {
81 if (!empty($this->username) && $this->verifyPassword($this->username, $this->password)) {
82 $this->setAuth($this->username);
83 } else {
84 $this->status = AUTH_WRONG_LOGIN;
85 }
86 }

References setAuth().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ logout()

ilPDOAuthentication::logout ( )
Returns
void

Implements ilAuthPDOInterface.

Definition at line 129 of file class.ilPDOAuthentication.php.

129 {
130 $_SESSION['_authsession'] = null;
131 }

References $_SESSION.

◆ sessionValidThru()

ilPDOAuthentication::sessionValidThru ( )

Returns the time up to the session is valid.

@access public

Returns
integer

Implements ilAuthPDOInterface.

Definition at line 124 of file class.ilPDOAuthentication.php.

124 {
125 return time() + 1000000;
126 }

◆ setAuth()

ilPDOAuthentication::setAuth (   $username)
private
Parameters
$username

Definition at line 150 of file class.ilPDOAuthentication.php.

150 {
151 // session_regenerate_id(true); doesn't seem to work on PHP7
152
153 if (!isset($_SESSION['_authsession'])) {
154 $_SESSION['_authsession'] = array();
155 }
156
157 $_SESSION['_authsession']['username'] = $username;
158 }

References $_SESSION, and $username.

Referenced by login().

+ Here is the caller graph for this function:

◆ setExpire()

ilPDOAuthentication::setExpire (   $time,
  $add = false 
)

Set the maximum expire time.

Parameters
int$timeTime in seconds
bool$addAdd time to current expire time or not
Returns
void

Implements ilAuthPDOInterface.

Definition at line 54 of file class.ilPDOAuthentication.php.

54 {
55 // TODO: Implement setExpire() method.
56 }

◆ setIdle()

ilPDOAuthentication::setIdle (   $time,
  $add = false 
)

Set maximum idle time.

Parameters
int$timeTime in seconds.
bool$addAdd to current idle time?
Returns
void

Implements ilAuthPDOInterface.

Definition at line 43 of file class.ilPDOAuthentication.php.

43 {
44 // TODO: Implement setIdle() method.
45 }

◆ start()

ilPDOAuthentication::start ( )

Start new auth session.

Returns
void

Implements ilAuthPDOInterface.

Definition at line 63 of file class.ilPDOAuthentication.php.

63 {
64 // TODO SAME AS old AUTH
65 $this->assignData();
66 if (!$this->checkAuth() && $this->allowLogin) {
67 $this->login();
68 }
69 }

References assignData(), checkAuth(), and login().

+ Here is the call graph for this function:

Field Documentation

◆ $_postPassword

ilPDOAuthentication::$_postPassword = 'password'
protected

Definition at line 13 of file class.ilPDOAuthentication.php.

Referenced by assignData().

◆ $_postUsername

ilPDOAuthentication::$_postUsername = 'username'
protected

Definition at line 12 of file class.ilPDOAuthentication.php.

Referenced by assignData().

◆ $_sessionName

ilPDOAuthentication::$_sessionName = '_authsession'
protected

Definition at line 10 of file class.ilPDOAuthentication.php.

Referenced by __construct().

◆ $advancedsecurity

ilPDOAuthentication::$advancedsecurity
protected

Definition at line 14 of file class.ilPDOAuthentication.php.

◆ $allowLogin

ilPDOAuthentication::$allowLogin = true
protected

Definition at line 11 of file class.ilPDOAuthentication.php.

◆ $cookie

ilPDOAuthentication::$cookie
protected

Definition at line 23 of file class.ilPDOAuthentication.php.

◆ $enableLogging

ilPDOAuthentication::$enableLogging
protected

Definition at line 15 of file class.ilPDOAuthentication.php.

◆ $password

ilPDOAuthentication::$password
protected

Definition at line 19 of file class.ilPDOAuthentication.php.

◆ $post

ilPDOAuthentication::$post
protected

Definition at line 22 of file class.ilPDOAuthentication.php.

◆ $regenerateSessionId

ilPDOAuthentication::$regenerateSessionId
protected

Definition at line 16 of file class.ilPDOAuthentication.php.

◆ $server

ilPDOAuthentication::$server
protected

Definition at line 21 of file class.ilPDOAuthentication.php.

◆ $session

ilPDOAuthentication::$session
protected

Definition at line 20 of file class.ilPDOAuthentication.php.

◆ $status

ilPDOAuthentication::$status = ''
protected

Definition at line 17 of file class.ilPDOAuthentication.php.

Referenced by getStatus().

◆ $username

ilPDOAuthentication::$username = null
protected

Definition at line 18 of file class.ilPDOAuthentication.php.

Referenced by setAuth().


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