ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilAuthProviderRadius Class Reference

Description of class class. More...

+ Inheritance diagram for ilAuthProviderRadius:
+ Collaboration diagram for ilAuthProviderRadius:

Public Member Functions

 __construct (\ilAuthCredentials $credentials)
 
 createNewAccount (\ilAuthStatus $status)
 create new account More...
 
 doAuthentication (\ilAuthStatus $status)
 do authentication More...
 
 getExternalAccountName ()
 get external account name More...
 
 getTriggerAuthMode ()
 get trigger auth mode More...
 
 getUserAuthModeName ()
 get user auth mode name More...
 
 migrateAccount (ilAuthStatus $status)
 Migrate existing account to radius authentication Create new account.
Parameters
ilAuthStatus
. More...
 
- Public Member Functions inherited from ilAuthProvider
 __construct (ilAuthCredentials $credentials)
 Constructor. More...
 
 getLogger ()
 Get logger. More...
 
 getCredentials ()
 
- Public Member Functions inherited from ilAuthProviderAccountMigrationInterface
 createNewAccount (ilAuthStatus $status)
 Create new ILIAS account for external_account. More...
 

Data Fields

const CONNECT_TIMEOUT = 3
 
const RETRIES = 1
 
- Data Fields inherited from ilAuthProvider
const STATUS_UNDEFINED = 0
 
const STATUS_AUTHENTICATION_SUCCESS = 1
 
const STATUS_AUTHENTICATION_FAILED = 2
 
const STATUS_MIGRATION = 3
 

Private Attributes

 $settings = null
 
 $external_account = ''
 

Additional Inherited Members

- Protected Member Functions inherited from ilAuthProvider
 handleAuthenticationFail (ilAuthStatus $status, $a_reason)
 Handle failed authentication. More...
 

Detailed Description

Description of class class.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

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

Constructor & Destructor Documentation

◆ __construct()

ilAuthProviderRadius::__construct ( \ilAuthCredentials  $credentials)

Definition at line 28 of file class.ilAuthProviderRadius.php.

References ilRadiusSettings\_getInstance(), and settings().

29  {
30  parent::__construct($credentials);
31 
32  include_once './Services/Radius/classes/class.ilRadiusSettings.php';
34  }
static _getInstance()
singleton get instance
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ createNewAccount()

ilAuthProviderRadius::createNewAccount ( \ilAuthStatus  $status)

create new account

Parameters
\ilAuthStatus$status

Definition at line 41 of file class.ilAuthProviderRadius.php.

42  {
43 
44  }

◆ doAuthentication()

ilAuthProviderRadius::doAuthentication ( \ilAuthStatus  $status)

do authentication

Parameters
\ilAuthStatus$status

Implements ilAuthProviderInterface.

Definition at line 50 of file class.ilAuthProviderRadius.php.

References $result, $server, ilObjUser\_checkExternalAuthAccount(), ilObjUser\_lookupId(), ilAuthProvider\getCredentials(), ilAuthProvider\getLogger(), ilAuthProvider\handleAuthenticationFail(), ilAuthStatus\setAuthenticatedUserId(), ilAuthStatus\setStatus(), settings(), and ilAuthStatus\STATUS_AUTHENTICATED.

51  {
52  $radius = radius_auth_open();
53 
54  foreach($this->settings->getServers() as $server)
55  {
56  $this->getLogger()->debug('Using: ' . $server.':'. $this->settings->getPort());
57  radius_add_server(
58  $radius,
59  trim($server),
60  $this->settings->getPort(),
61  $this->settings->getSecret(),
62  self::CONNECT_TIMEOUT,
63  self::RETRIES
64  );
65  }
66 
67  radius_create_request($radius, RADIUS_ACCESS_REQUEST);
68  radius_put_attr($radius, RADIUS_USER_NAME, $this->getCredentials()->getUsername());
69  radius_put_attr($radius, RADIUS_USER_PASSWORD, $this->getCredentials()->getPassword());
70 
71  $this->getLogger()->debug('username: ' . $this->getCredentials()->getUsername());
72 
73  $result = radius_send_request($radius);
74 
75  switch($result)
76  {
77  case RADIUS_ACCESS_ACCEPT:
78  $this->getLogger()->info('Radius authentication successful.');
80 
81  $local_login = ilObjUser::_checkExternalAuthAccount('radius',$this->getCredentials()->getUsername());
82  $status->setAuthenticatedUserId(ilObjUser::_lookupId($local_login));
83  return true;
84 
85  case RADIUS_ACCESS_REJECT:
86  $this->getLogger()->info('Radius authentication rejected with message: ' . radius_strerror($radius));
87  $this->handleAuthenticationFail($status, 'err_wrong_login');
88  return false;
89 
90  case RADIUS_ACCESS_CHALLENGE:
91  $this->getLogger()->info('Radius authentication failed (access challenge): ' . radius_strerror($radius));
92  $this->handleAuthenticationFail($status, 'err_wrong_login');
93  return false;
94 
95  default:
96  $this->getLogger()->error('Radius authentication failed with message: ' . radius_strerror($radius));
97  $this->handleAuthenticationFail($status, 'err_wrong_login');
98  return false;
99  }
100  }
$result
static _lookupId($a_user_str)
Lookup id by login.
getLogger()
Get logger.
$server
settings()
Definition: settings.php:2
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
handleAuthenticationFail(ilAuthStatus $status, $a_reason)
Handle failed authentication.
+ Here is the call graph for this function:

◆ getExternalAccountName()

ilAuthProviderRadius::getExternalAccountName ( )

get external account name

Returns
string Get external account for accoun migration

Implements ilAuthProviderAccountMigrationInterface.

Definition at line 106 of file class.ilAuthProviderRadius.php.

References $external_account.

◆ getTriggerAuthMode()

ilAuthProviderRadius::getTriggerAuthMode ( )

get trigger auth mode

Returns
string

Implements ilAuthProviderAccountMigrationInterface.

Definition at line 115 of file class.ilAuthProviderRadius.php.

References AUTH_RADIUS.

116  {
117  return AUTH_RADIUS;
118  }
const AUTH_RADIUS

◆ getUserAuthModeName()

ilAuthProviderRadius::getUserAuthModeName ( )

get user auth mode name

Returns
string

Implements ilAuthProviderAccountMigrationInterface.

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

125  {
126  return 'radius';
127  }

◆ migrateAccount()

ilAuthProviderRadius::migrateAccount ( ilAuthStatus  $status)

Migrate existing account to radius authentication Create new account.

Parameters
ilAuthStatus
.

Implements ilAuthProviderAccountMigrationInterface.

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

134  {
135 
136  }

Field Documentation

◆ $external_account

ilAuthProviderRadius::$external_account = ''
private

Definition at line 25 of file class.ilAuthProviderRadius.php.

Referenced by getExternalAccountName().

◆ $settings

ilAuthProviderRadius::$settings = null
private

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

◆ CONNECT_TIMEOUT

const ilAuthProviderRadius::CONNECT_TIMEOUT = 3

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

◆ RETRIES

const ilAuthProviderRadius::RETRIES = 1

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


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