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 ()
 

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.

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  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$_SESSION["AccountId"]
$_COOKIE['ilClientId']
Definition: BPMN2Parser.php:15
$_POST["username"]

Member Function Documentation

◆ assignData()

ilPDOAuthentication::assignData ( )
protected

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

References $_postPassword, and $_postUsername.

Referenced by start().

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  }
+ Here is the caller graph for this function:

◆ checkAuth()

ilPDOAuthentication::checkAuth ( )
protected
Returns
bool

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

References $_SESSION.

Referenced by getAuth(), and start().

75  {
76  return isset($_SESSION['_authsession']['username']);
77  }
$_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 97 of file class.ilPDOAuthentication.php.

References checkAuth().

97  {
98  return $this->checkAuth();
99  }
+ 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.

105  {
106  return $this->status;
107  }

◆ getUsername()

ilPDOAuthentication::getUsername ( )
Returns
string

Implements ilAuthPDOInterface.

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

References $_SESSION.

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

◆ login()

ilPDOAuthentication::login ( )
protected

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

References setAuth().

Referenced by start().

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  }
+ 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.

References $_SESSION.

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

◆ sessionValidThru()

ilPDOAuthentication::sessionValidThru ( )

Returns the time up to the session is valid.

public

Returns
integer

Implements ilAuthPDOInterface.

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

References time.

124  {
125  return time() + 1000000;
126  }
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 150 of file class.ilPDOAuthentication.php.

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

Referenced by login().

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  }
$_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 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.

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

63  {
64  // TODO SAME AS old AUTH
65  $this->assignData();
66  if (!$this->checkAuth() && $this->allowLogin) {
67  $this->login();
68  }
69  }
+ 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: