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

◆ doAuthentication()

ilAuthProviderRadius::doAuthentication ( \ilAuthStatus  $status)

do authentication

Parameters
\ilAuthStatus$status

Implements ilAuthProviderInterface.

Definition at line 49 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.

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

References $external_account.

◆ getTriggerAuthMode()

ilAuthProviderRadius::getTriggerAuthMode ( )

get trigger auth mode

Returns
string

Implements ilAuthProviderAccountMigrationInterface.

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

References AUTH_RADIUS.

113  {
114  return AUTH_RADIUS;
115  }
const AUTH_RADIUS

◆ getUserAuthModeName()

ilAuthProviderRadius::getUserAuthModeName ( )

get user auth mode name

Returns
string

Implements ilAuthProviderAccountMigrationInterface.

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

122  {
123  return 'radius';
124  }

◆ migrateAccount()

ilAuthProviderRadius::migrateAccount ( ilAuthStatus  $status)

Migrate existing account to radius authentication Create new account.

Parameters
ilAuthStatus
.

Implements ilAuthProviderAccountMigrationInterface.

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

131  {
132  }

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: