ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ()
 

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.

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

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

Member Function Documentation

◆ assignData()

ilPDOAuthentication::assignData ( )
protected

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

References $_postPassword, and $_postUsername.

Referenced by start().

145  {
146  if (isset($this->post[$this->_postUsername])
147  && $this->post[$this->_postUsername] != ''
148  ) {
149  $this->username = (get_magic_quotes_gpc() == 1 ? stripslashes($this->post[$this->_postUsername]) : $this->post[$this->_postUsername]);
150  }
151  if (isset($this->post[$this->_postPassword])
152  && $this->post[$this->_postPassword] != ''
153  ) {
154  $this->password = (get_magic_quotes_gpc() == 1 ? stripslashes($this->post[$this->_postPassword]) : $this->post[$this->_postPassword]);
155  }
156  }
+ Here is the caller graph for this function:

◆ checkAuth()

ilPDOAuthentication::checkAuth ( )
protected
Returns
bool

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

References $_SESSION.

Referenced by getAuth(), and start().

80  {
81  return isset($_SESSION['_authsession']['username']);
82  }
$_SESSION["AccountId"]
+ 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 103 of file class.ilPDOAuthentication.php.

References checkAuth().

104  {
105  return $this->checkAuth();
106  }
+ Here is the call graph for this function:

◆ getStatus()

ilPDOAuthentication::getStatus ( )
Returns
string

Implements ilAuthPDOInterface.

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

References $status.

113  {
114  return $this->status;
115  }

◆ getUsername()

ilPDOAuthentication::getUsername ( )
Returns
string

Implements ilAuthPDOInterface.

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

References $_SESSION.

122  {
123  return $_SESSION['_authsession']['username'];
124  }
$_SESSION["AccountId"]

◆ login()

ilPDOAuthentication::login ( )
protected

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

References setAuth().

Referenced by start().

86  {
87  if (!empty($this->username) && $this->verifyPassword($this->username, $this->password)) {
88  $this->setAuth($this->username);
89  } else {
90  $this->status = AUTH_WRONG_LOGIN;
91  }
92  }
+ 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 139 of file class.ilPDOAuthentication.php.

References $_SESSION.

140  {
141  $_SESSION['_authsession'] = null;
142  }
$_SESSION["AccountId"]

◆ sessionValidThru()

ilPDOAuthentication::sessionValidThru ( )

Returns the time up to the session is valid.

public

Returns
integer

Implements ilAuthPDOInterface.

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

References time.

134  {
135  return time() + 1000000;
136  }
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.

◆ setAuth()

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

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

References $_SESSION, $password, $username, ilObjUser\_loginExists(), array, ilUserPasswordManager\getInstance(), and ilObjectFactory\getInstanceByObjId().

Referenced by login().

163  {
164  // session_regenerate_id(true); doesn't seem to work on PHP7
165 
166  if (!isset($_SESSION['_authsession'])) {
167  $_SESSION['_authsession'] = array();
168  }
169 
170  $_SESSION['_authsession']['username'] = $username;
171  }
$_SESSION["AccountId"]
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ 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 56 of file class.ilPDOAuthentication.php.

57  {
58  // TODO: Implement setExpire() method.
59  }

◆ 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 44 of file class.ilPDOAuthentication.php.

45  {
46  // TODO: Implement setIdle() method.
47  }

◆ start()

ilPDOAuthentication::start ( )

Start new auth session.

Returns
void

Implements ilAuthPDOInterface.

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

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

67  {
68  // TODO SAME AS old AUTH
69  $this->assignData();
70  if (!$this->checkAuth() && $this->allowLogin) {
71  $this->login();
72  }
73  }
+ 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.

Referenced by setAuth().

◆ $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: