ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Auth_Container_RADIUS Class Reference
+ Inheritance diagram for Auth_Container_RADIUS:
+ Collaboration diagram for Auth_Container_RADIUS:

Public Member Functions

 Auth_Container_RADIUS ($options)
 Constructor of the container class. More...
 
 fetchData ($username, $password, $challenge=null)
 Authenticate. More...
 
- Public Member Functions inherited from Auth_Container
 Auth_Container ()
 Constructor. More...
 
 fetchData ($username, $password, $isChallengeResponse=false)
 Fetch data from storage container. More...
 
 verifyPassword ($password1, $password2, $cryptType="md5")
 Crypt and verfiy the entered password. More...
 
 supportsChallengeResponse ()
 Returns true if the container supports Challenge Response password authentication. More...
 
 getCryptType ()
 Returns the crypt current crypt type of the container. More...
 
 listUsers ()
 List all users that are available from the storage container. More...
 
 getUser ($username)
 Returns a user assoc array. More...
 
 addUser ($username, $password, $additional=null)
 Add a new user to the storage container. More...
 
 removeUser ($username)
 Remove user from the storage container. More...
 
 changePassword ($username, $password)
 Change password for user in the storage container. More...
 
 log ($message, $level=AUTH_LOG_DEBUG)
 Log a message to the Auth log. More...
 
- Public Member Functions inherited from ilAuthContainerBase
 loginObserver ($a_username, $a_auth)
 Called after successful login. More...
 
 failedLoginObserver ($a_username, $a_auth)
 Called after failed login. More...
 
 checkAuthObserver ($a_username, $a_auth)
 Called after check auth requests. More...
 
 logoutObserver ($a_username, $a_auth)
 Called after logout. More...
 
 supportsCaptchaVerification ()
 Returns whether or not the auth container supports the verification of captchas This should be true for those auth methods, which are available in the default login form. More...
 

Data Fields

 $radius
 
 $authtype
 
- Data Fields inherited from Auth_Container
 $activeUser = ""
 User that is currently selected from the storage container. More...
 
 $_auth_obj = null
 The Auth object this container is attached to. More...
 

Detailed Description

Definition at line 48 of file RADIUS.php.

Member Function Documentation

◆ Auth_Container_RADIUS()

Auth_Container_RADIUS::Auth_Container_RADIUS (   $options)

Constructor of the container class.

$options can have these keys: 'servers' an array containing an array: servername, port, sharedsecret, timeout, maxtries 'configfile' The filename of the configuration file 'authtype' The type of authentication, one of: PAP, CHAP_MD5, MSCHAPv1, MSCHAPv2, default is PAP

Parameters
$optionsassociative array
Returns
object Returns an error object if something went wrong

Definition at line 81 of file RADIUS.php.

82 {
83 $this->authtype = 'PAP';
84 if (isset($options['authtype'])) {
85 $this->authtype = $options['authtype'];
86 }
87 $classname = 'Auth_RADIUS_' . $this->authtype;
88 if (!class_exists($classname)) {
89 PEAR::raiseError("Unknown Authtype, please use one of: "
90 ."PAP, CHAP_MD5, MSCHAPv1, MSCHAPv2!", 41, PEAR_ERROR_DIE);
91 }
92
93 $this->radius = new $classname;
94
95 if (isset($options['configfile'])) {
96 $this->radius->setConfigfile($options['configfile']);
97 }
98
99 $servers = $options['servers'];
100 if (is_array($servers)) {
101 foreach ($servers as $server) {
102 $servername = $server[0];
103 $port = isset($server[1]) ? $server[1] : 0;
104 $sharedsecret = isset($server[2]) ? $server[2] : 'testing123';
105 $timeout = isset($server[3]) ? $server[3] : 3;
106 $maxtries = isset($server[4]) ? $server[4] : 3;
107 $this->radius->addServer($servername, $port, $sharedsecret, $timeout, $maxtries);
108 }
109 }
110
111 if (!$this->radius->start()) {
112 PEAR::raiseError($this->radius->getError(), 41, PEAR_ERROR_DIE);
113 }
114 }
const PEAR_ERROR_DIE
Definition: PEAR.php:34
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object's de...
Definition: PEAR.php:524
$server
if(!is_array($argv)) $options

References $authtype, $options, $server, PEAR_ERROR_DIE, and PEAR\raiseError().

+ Here is the call graph for this function:

◆ fetchData()

Auth_Container_RADIUS::fetchData (   $username,
  $password,
  $challenge = null 
)

Authenticate.

Parameters
stringUsername
stringPassword
Returns
bool true on success, false on reject

Reimplemented from Auth_Container.

Definition at line 126 of file RADIUS.php.

127 {
128 $this->log('Auth_Container_RADIUS::fetchData() called.', AUTH_LOG_DEBUG);
129
130 switch($this->authtype) {
131 case 'CHAP_MD5':
132 case 'MSCHAPv1':
133 if (isset($challenge)) {
134 $this->radius->challenge = $challenge;
135 $this->radius->chapid = 1;
136 $this->radius->response = pack('H*', $password);
137 } else {
138 require_once 'Crypt/CHAP.php';
139 $classname = 'Crypt_' . $this->authtype;
140 $crpt = new $classname;
141 $crpt->password = $password;
142 $this->radius->challenge = $crpt->challenge;
143 $this->radius->chapid = $crpt->chapid;
144 $this->radius->response = $crpt->challengeResponse();
145 }
146 break;
147
148 case 'MSCHAPv2':
149 require_once 'Crypt/CHAP.php';
150 $crpt = new Crypt_MSCHAPv2;
151 $crpt->username = $username;
152 $crpt->password = $password;
153 $this->radius->challenge = $crpt->authChallenge;
154 $this->radius->peerChallenge = $crpt->peerChallenge;
155 $this->radius->chapid = $crpt->chapid;
156 $this->radius->response = $crpt->challengeResponse();
157 break;
158
159 default:
160 $this->radius->password = $password;
161 break;
162 }
163
164 $this->radius->username = $username;
165
166 $this->radius->putAuthAttributes();
167 $result = $this->radius->send();
168 if (PEAR::isError($result)) {
169 return false;
170 }
171
172 $this->radius->getAttributes();
173// just for debugging
174// $this->radius->dumpAttributes();
175
176 return $result;
177 }
const AUTH_LOG_DEBUG
Auth Log level - DEBUG.
Definition: Auth.php:59
$result
log($message, $level=AUTH_LOG_DEBUG)
Log a message to the Auth log.
Definition: Container.php:246
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:279

References $authtype, $result, AUTH_LOG_DEBUG, PEAR\isError(), and Auth_Container\log().

+ Here is the call graph for this function:

Field Documentation

◆ $authtype

Auth_Container_RADIUS::$authtype

Definition at line 63 of file RADIUS.php.

Referenced by Auth_Container_RADIUS(), and fetchData().

◆ $radius

Auth_Container_RADIUS::$radius

Definition at line 57 of file RADIUS.php.


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