ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilOpenIdConnectSettings Class Reference
+ Collaboration diagram for ilOpenIdConnectSettings:

Public Member Functions

 setActive (bool $active)
 
 getActive ()
 
 setProvider (string $url)
 
 getProvider ()
 
 setClientId (string $client_id)
 
 getClientId ()
 
 setSecret (string $secret)
 
 getSecret ()
 
 setLoginElementType (int $type)
 
 getLoginElementType ()
 
 setLoginElementImage (string $a_img_name)
 
 getLoginElementImage ()
 
 setLoginElementText (string $text)
 
 getLoginElemenText ()
 
 setLoginPromptType (int $a_type)
 
 getLoginPromptType ()
 
 setLogoutScope (int $a_scope)
 
 getLogoutScope ()
 
 useCustomSession (bool $a_stat)
 
 isCustomSession ()
 
 setSessionDuration (int $a_duration)
 
 getSessionDuration ()
 
 isSyncAllowed ()
 
 allowSync (bool $a_stat)
 
 setRole (int $role)
 
 getRole ()
 
 setUidField (string $field)
 
 getUidField ()
 
 getAdditionalScopes ()
 
 setAdditionalScopes (array $additional_scopes)
 
 getAllScopes ()
 
 deleteImageFile ()
 
 hasImageFile ()
 
 getImageFilePath ()
 
 setRoleMappings (array $a_role_mappings)
 
 getRoleMappings ()
 
 getRoleMappingValueForId (int $a_role_id)
 
 getRoleMappingUpdateForId (int $a_role_id)
 
 validateScopes (string $discoveryURL, array $custom_scopes)
 
 getSupportedScopesFromUrl (string $discoveryURL)
 
 save ()
 
 getProfileMappingFieldValue (string $field)
 
 clearProfileMaps ()
 
 setProfileMappingFieldValue (string $field, string $value)
 
 getProfileMappingFieldUpdate (string $field)
 
 setProfileMappingFieldUpdate (string $field, bool $value)
 
 setValidateScopes (int $validation_mode)
 
 getValidateScopes ()
 
 setCustomDiscoveryUrl (?string $discoveryUrl)
 
 getCustomDiscoveryUrl ()
 
 getProfileMappingFields ()
 

Static Public Member Functions

static getInstance ()
 

Data Fields

const FILE_STORAGE = 'openidconnect/login_form_image'
 
const DEFAULT_SCOPE = 'openid'
 
const LOGIN_ELEMENT_TYPE_TXT = 0
 
const LOGIN_ELEMENT_TYPE_IMG = 1
 
const LOGIN_ENFORCE = 0
 
const LOGIN_STANDARD = 1
 
const LOGOUT_SCOPE_GLOBAL = 0
 
const LOGOUT_SCOPE_LOCAL = 1
 
const URL_VALIDATION_PROVIDER = 0
 
const URL_VALIDATION_CUSTOM = 1
 
const URL_VALIDATION_NONE = 2
 
const VALIDATION_ISSUE_INVALID_SCOPE = 0
 
const VALIDATION_ISSUE_DISCOVERY_ERROR = 1
 

Protected Member Functions

 load ()
 

Private Member Functions

 __construct ()
 

Private Attributes

const STORAGE_ID = 'oidc'
 
const IGNORED_USER_FIELDS
 
readonly ilSetting $storage
 
readonly Filesystem $filesystem
 
bool $active = false
 
string $provider = ''
 
string $client_id = ''
 
string $secret = ''
 
int $login_element_type = self::LOGIN_ELEMENT_TYPE_TXT
 
string $login_element_img_name = null
 
string $login_element_text = null
 
int $login_prompt_type = self::LOGIN_ENFORCE
 
int $logout_scope = null
 
bool $custom_session = false
 
int $session_duration = 60
 
bool $allow_sync = null
 
int $role = null
 
string $uid = ''
 
array $profile_map = []
 
array $profile_update_map = []
 
array $role_mappings = []
 
array $additional_scopes = []
 
int $validate_scopes = self::URL_VALIDATION_PROVIDER
 
string $custom_discovery_url = null
 
ilLanguage $lng
 
ilUserDefinedFields $udf
 

Static Private Attributes

static self $instance = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilOpenIdConnectSettings::__construct ( )
private

Definition at line 94 of file class.ilOpenIdConnectSettings.php.

References $DIC, ilUserDefinedFields\_getInstance(), ILIAS\Repository\filesystem(), ILIAS\Repository\lng(), and load().

95  {
96  global $DIC;
97 
98  $this->storage = new ilSetting(self::STORAGE_ID);
99  $this->filesystem = $DIC->filesystem()->web();
100  $this->lng = $DIC->language();
101  $this->udf = ilUserDefinedFields::_getInstance();
102  $this->load();
103  }
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ allowSync()

ilOpenIdConnectSettings::allowSync ( bool  $a_stat)

Definition at line 229 of file class.ilOpenIdConnectSettings.php.

Referenced by load().

229  : void
230  {
231  $this->allow_sync = $a_stat;
232  }
+ Here is the caller graph for this function:

◆ clearProfileMaps()

ilOpenIdConnectSettings::clearProfileMaps ( )

Definition at line 501 of file class.ilOpenIdConnectSettings.php.

501  : void
502  {
503  $this->profile_map = [];
504  $this->profile_update_map = [];
505  }

◆ deleteImageFile()

ilOpenIdConnectSettings::deleteImageFile ( )

Definition at line 281 of file class.ilOpenIdConnectSettings.php.

References ILIAS\Repository\filesystem(), and getLoginElementImage().

281  : void
282  {
283  if ($this->filesystem->has(self::FILE_STORAGE . '/' . $this->getLoginElementImage())) {
284  $this->filesystem->delete(self::FILE_STORAGE . '/' . $this->getLoginElementImage());
285  }
286  }
+ Here is the call graph for this function:

◆ getActive()

ilOpenIdConnectSettings::getActive ( )

Definition at line 119 of file class.ilOpenIdConnectSettings.php.

References $active.

Referenced by save().

119  : bool
120  {
121  return $this->active;
122  }
+ Here is the caller graph for this function:

◆ getAdditionalScopes()

ilOpenIdConnectSettings::getAdditionalScopes ( )
Returns
string[]

Definition at line 257 of file class.ilOpenIdConnectSettings.php.

References $additional_scopes.

Referenced by save().

257  : array
258  {
260  }
+ Here is the caller graph for this function:

◆ getAllScopes()

ilOpenIdConnectSettings::getAllScopes ( )
Returns
list<string>

Definition at line 273 of file class.ilOpenIdConnectSettings.php.

References $additional_scopes, and $scopes.

273  : array
274  {
276  array_unshift($scopes, self::DEFAULT_SCOPE);
277 
278  return $scopes;
279  }
$scopes
Definition: ltitoken.php:96

◆ getClientId()

ilOpenIdConnectSettings::getClientId ( )

Definition at line 139 of file class.ilOpenIdConnectSettings.php.

References $client_id.

Referenced by save().

139  : string
140  {
141  return $this->client_id;
142  }
+ Here is the caller graph for this function:

◆ getCustomDiscoveryUrl()

ilOpenIdConnectSettings::getCustomDiscoveryUrl ( )

Definition at line 537 of file class.ilOpenIdConnectSettings.php.

References $custom_discovery_url.

Referenced by save().

537  : ?string
538  {
540  }
+ Here is the caller graph for this function:

◆ getImageFilePath()

ilOpenIdConnectSettings::getImageFilePath ( )

Definition at line 295 of file class.ilOpenIdConnectSettings.php.

References getLoginElementImage(), and ilFileUtils\getWebspaceDir().

295  : string
296  {
297  return implode(
298  '/',
299  [
301  self::FILE_STORAGE . '/' . $this->getLoginElementImage()
302  ]
303  );
304  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ getInstance()

static ilOpenIdConnectSettings::getInstance ( )
static

Definition at line 105 of file class.ilOpenIdConnectSettings.php.

References null.

Referenced by ilAuthFrontendCredentialsOpenIdConnect\__construct(), ilAuthProviderOpenIdConnect\__construct(), ilOpenIdConnectSettingsGUI\__construct(), ilAuthUtils\_getActiveAuthModes(), ilAuthUtils\_isExternalAccountEnabled(), ilObjAuthSettingsGUI\authSettingsObject(), and ilStartUpGUI\showOpenIdConnectLoginForm().

105  : self
106  {
107  if (self::$instance === null) {
108  self::$instance = new self();
109  }
110 
111  return self::$instance;
112  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getLoginElemenText()

ilOpenIdConnectSettings::getLoginElemenText ( )

Definition at line 179 of file class.ilOpenIdConnectSettings.php.

References $login_element_text.

Referenced by save().

179  : string
180  {
182  }
+ Here is the caller graph for this function:

◆ getLoginElementImage()

ilOpenIdConnectSettings::getLoginElementImage ( )

Definition at line 169 of file class.ilOpenIdConnectSettings.php.

References $login_element_img_name.

Referenced by deleteImageFile(), getImageFilePath(), hasImageFile(), and save().

169  : string
170  {
172  }
+ Here is the caller graph for this function:

◆ getLoginElementType()

ilOpenIdConnectSettings::getLoginElementType ( )

Definition at line 159 of file class.ilOpenIdConnectSettings.php.

References $login_element_type.

Referenced by save().

159  : int
160  {
162  }
+ Here is the caller graph for this function:

◆ getLoginPromptType()

ilOpenIdConnectSettings::getLoginPromptType ( )

Definition at line 189 of file class.ilOpenIdConnectSettings.php.

References $login_prompt_type.

Referenced by save().

189  : int
190  {
192  }
+ Here is the caller graph for this function:

◆ getLogoutScope()

ilOpenIdConnectSettings::getLogoutScope ( )

Definition at line 199 of file class.ilOpenIdConnectSettings.php.

References $logout_scope.

Referenced by save().

199  : int
200  {
201  return $this->logout_scope;
202  }
+ Here is the caller graph for this function:

◆ getProfileMappingFields()

ilOpenIdConnectSettings::getProfileMappingFields ( )
Returns
array<string, string>

Definition at line 545 of file class.ilOpenIdConnectSettings.php.

References $id, and ILIAS\Repository\lng().

Referenced by load(), and save().

545  : array
546  {
547  $mapping_fields = [];
548  $usr_profile = new ilUserProfile();
549 
550  foreach ($usr_profile->getStandardFields() as $id => $definition) {
551  if (in_array($id, self::IGNORED_USER_FIELDS, true)) {
552  continue;
553  }
554  $mapping_fields[$id] = $this->lng->txt($id);
555  }
556 
557  return $mapping_fields;
558  }
Class ilUserProfile.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProfileMappingFieldUpdate()

ilOpenIdConnectSettings::getProfileMappingFieldUpdate ( string  $field)

Definition at line 512 of file class.ilOpenIdConnectSettings.php.

Referenced by save().

512  : bool
513  {
514  return (bool) ($this->profile_update_map[$field] ?? false);
515  }
+ Here is the caller graph for this function:

◆ getProfileMappingFieldValue()

ilOpenIdConnectSettings::getProfileMappingFieldValue ( string  $field)

Definition at line 496 of file class.ilOpenIdConnectSettings.php.

Referenced by save().

496  : string
497  {
498  return (string) ($this->profile_map[$field] ?? '');
499  }
+ Here is the caller graph for this function:

◆ getProvider()

ilOpenIdConnectSettings::getProvider ( )

Definition at line 129 of file class.ilOpenIdConnectSettings.php.

References $provider.

Referenced by save().

129  : string
130  {
131  return $this->provider;
132  }
+ Here is the caller graph for this function:

◆ getRole()

ilOpenIdConnectSettings::getRole ( )

Definition at line 239 of file class.ilOpenIdConnectSettings.php.

References $role.

Referenced by save().

239  : int
240  {
241  return $this->role;
242  }
+ Here is the caller graph for this function:

◆ getRoleMappings()

ilOpenIdConnectSettings::getRoleMappings ( )
Returns
array<int, array{value: string, update: bool}>

Definition at line 317 of file class.ilOpenIdConnectSettings.php.

References $role_mappings.

Referenced by save().

317  : array
318  {
319  return $this->role_mappings;
320  }
+ Here is the caller graph for this function:

◆ getRoleMappingUpdateForId()

ilOpenIdConnectSettings::getRoleMappingUpdateForId ( int  $a_role_id)

Definition at line 331 of file class.ilOpenIdConnectSettings.php.

331  : bool
332  {
333  if (isset($this->role_mappings[$a_role_id]['update'])) {
334  return (bool) $this->role_mappings[$a_role_id]['update'];
335  }
336 
337  return false;
338  }

◆ getRoleMappingValueForId()

ilOpenIdConnectSettings::getRoleMappingValueForId ( int  $a_role_id)

Definition at line 322 of file class.ilOpenIdConnectSettings.php.

322  : string
323  {
324  if (isset($this->role_mappings[$a_role_id]['value'])) {
325  return (string) $this->role_mappings[$a_role_id]['value'];
326  }
327 
328  return '';
329  }

◆ getSecret()

ilOpenIdConnectSettings::getSecret ( )

Definition at line 149 of file class.ilOpenIdConnectSettings.php.

References $secret.

Referenced by save().

149  : string
150  {
151  return $this->secret;
152  }
+ Here is the caller graph for this function:

◆ getSessionDuration()

ilOpenIdConnectSettings::getSessionDuration ( )

Definition at line 219 of file class.ilOpenIdConnectSettings.php.

References $session_duration.

Referenced by save().

219  : int
220  {
222  }
+ Here is the caller graph for this function:

◆ getSupportedScopesFromUrl()

ilOpenIdConnectSettings::getSupportedScopesFromUrl ( string  $discoveryURL)

Definition at line 382 of file class.ilOpenIdConnectSettings.php.

References $response, and setAdditionalScopes().

382  : bool
383  {
384  try {
385  $curl = new ilCurlConnection($discoveryURL);
386  $curl->init();
387 
388  $curl->setOpt(CURLOPT_HEADER, 0);
389  $curl->setOpt(CURLOPT_RETURNTRANSFER, true);
390  $curl->setOpt(CURLOPT_TIMEOUT, 4);
391 
392  $response = $curl->exec();
393 
394  if ($curl->getInfo(CURLINFO_RESPONSE_CODE) === 200) {
395  $decoded_response = json_decode($response, false, 512, JSON_THROW_ON_ERROR);
396 
397  if (isset($decoded_response->scopes_supported) &&
398  is_array($decoded_response->scopes_supported) &&
399  $decoded_response->scopes_supported !== []) {
400  $available_scopes = $decoded_response->scopes_supported;
401  $this->setAdditionalScopes($available_scopes);
402 
403  return true;
404  }
405  }
406  } finally {
407  if (isset($curl)) {
408  $curl->close();
409  }
410  }
411 
412  return false;
413  }
$response
Definition: xapitoken.php:93
setAdditionalScopes(array $additional_scopes)
+ Here is the call graph for this function:

◆ getUidField()

ilOpenIdConnectSettings::getUidField ( )

Definition at line 249 of file class.ilOpenIdConnectSettings.php.

References $uid.

Referenced by save().

249  : string
250  {
251  return $this->uid;
252  }
+ Here is the caller graph for this function:

◆ getValidateScopes()

ilOpenIdConnectSettings::getValidateScopes ( )

Definition at line 527 of file class.ilOpenIdConnectSettings.php.

References $validate_scopes.

Referenced by load(), and save().

527  : int
528  {
529  return $this->validate_scopes;
530  }
+ Here is the caller graph for this function:

◆ hasImageFile()

ilOpenIdConnectSettings::hasImageFile ( )

Definition at line 288 of file class.ilOpenIdConnectSettings.php.

References ILIAS\Repository\filesystem(), and getLoginElementImage().

288  : bool
289  {
290  return
291  $this->getLoginElementImage() !== '' &&
292  $this->filesystem->has(self::FILE_STORAGE . '/' . $this->getLoginElementImage());
293  }
+ Here is the call graph for this function:

◆ isCustomSession()

ilOpenIdConnectSettings::isCustomSession ( )

Definition at line 209 of file class.ilOpenIdConnectSettings.php.

References $custom_session.

Referenced by save().

209  : bool
210  {
211  return $this->custom_session;
212  }
+ Here is the caller graph for this function:

◆ isSyncAllowed()

ilOpenIdConnectSettings::isSyncAllowed ( )

Definition at line 224 of file class.ilOpenIdConnectSettings.php.

References $allow_sync.

Referenced by save().

224  : bool
225  {
226  return $this->allow_sync;
227  }
+ Here is the caller graph for this function:

◆ load()

ilOpenIdConnectSettings::load ( )
protected

Definition at line 452 of file class.ilOpenIdConnectSettings.php.

References allowSync(), getProfileMappingFields(), getValidateScopes(), setActive(), setAdditionalScopes(), setClientId(), setCustomDiscoveryUrl(), setLoginElementImage(), setLoginElementText(), setLoginElementType(), setLoginPromptType(), setLogoutScope(), setProvider(), setRole(), setRoleMappings(), setSecret(), setSessionDuration(), setUidField(), setValidateScopes(), and useCustomSession().

Referenced by __construct().

452  : void
453  {
454  foreach ($this->getProfileMappingFields() as $field => $lang_key) {
455  $this->profile_map[$field] = (string) $this->storage->get('pmap_' . $field, '');
456  $this->profile_update_map[$field] = (bool) $this->storage->get('pumap_' . $field, '0');
457  }
458  foreach ($this->udf->getDefinitions() as $definition) {
459  $field = 'udf_' . $definition['field_id'];
460  $this->profile_map[$field] = (string) $this->storage->get('pmap_' . $field, '');
461  $this->profile_update_map[$field] = (bool) $this->storage->get('pumap_' . $field, '0');
462  }
463 
464  $this->setActive((bool) $this->storage->get('active', '0'));
465  $this->setProvider($this->storage->get('provider', ''));
466  $this->setClientId($this->storage->get('client_id', ''));
467  $this->setSecret($this->storage->get('secret', ''));
468  $this->setAdditionalScopes(
469  (array) unserialize(
470  $this->storage->get('scopes', serialize([])),
471  ['allowed_classes' => false]
472  )
473  );
474  $this->setLoginElementImage($this->storage->get('le_img', ''));
475  $this->setLoginElementText((string) $this->storage->get('le_text'));
476  $this->setLoginElementType((int) $this->storage->get('le_type'));
477  $this->setLoginPromptType((int) $this->storage->get('prompt_type', (string) self::LOGIN_ENFORCE));
478  $this->setLogoutScope((int) $this->storage->get('logout_scope', (string) self::LOGOUT_SCOPE_GLOBAL));
479  $this->useCustomSession((bool) $this->storage->get('custom_session', '0'));
480  $this->setSessionDuration((int) $this->storage->get('session_duration', '60'));
481  $this->allowSync((bool) $this->storage->get('allow_sync', '0'));
482  $this->setRole((int) $this->storage->get('role', '0'));
483  $this->setUidField((string) $this->storage->get('uid', ''));
484  $this->setRoleMappings(
485  (array) unserialize(
486  $this->storage->get('role_mappings', serialize([])),
487  ['allowed_classes' => false]
488  )
489  );
490  $this->setValidateScopes((int) $this->storage->get('validate_scopes', (string) self::URL_VALIDATION_PROVIDER));
491  if (self::URL_VALIDATION_CUSTOM === $this->getValidateScopes()) {
492  $this->setCustomDiscoveryUrl($this->storage->get('custom_discovery_url'));
493  }
494  }
setCustomDiscoveryUrl(?string $discoveryUrl)
setRoleMappings(array $a_role_mappings)
setAdditionalScopes(array $additional_scopes)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilOpenIdConnectSettings::save ( )

Definition at line 415 of file class.ilOpenIdConnectSettings.php.

References getActive(), getAdditionalScopes(), getClientId(), getCustomDiscoveryUrl(), getLoginElemenText(), getLoginElementImage(), getLoginElementType(), getLoginPromptType(), getLogoutScope(), getProfileMappingFields(), getProfileMappingFieldUpdate(), getProfileMappingFieldValue(), getProvider(), getRole(), getRoleMappings(), getSecret(), getSessionDuration(), getUidField(), getValidateScopes(), isCustomSession(), and isSyncAllowed().

415  : void
416  {
417  $this->storage->set('active', (string) ((int) $this->getActive()));
418  $this->storage->set('provider', $this->getProvider());
419  $this->storage->set('client_id', $this->getClientId());
420  $this->storage->set('secret', $this->getSecret());
421  $this->storage->set('scopes', serialize($this->getAdditionalScopes()));
422  $this->storage->set('le_img', $this->getLoginElementImage());
423  $this->storage->set('le_text', $this->getLoginElemenText());
424  $this->storage->set('le_type', (string) $this->getLoginElementType());
425  $this->storage->set('prompt_type', (string) $this->getLoginPromptType());
426  $this->storage->set('logout_scope', (string) $this->getLogoutScope());
427  $this->storage->set('custom_session', (string) ((int) $this->isCustomSession()));
428  $this->storage->set('session_duration', (string) $this->getSessionDuration());
429  $this->storage->set('allow_sync', (string) ((int) $this->isSyncAllowed()));
430  $this->storage->set('role', (string) $this->getRole());
431  $this->storage->set('uid', $this->getUidField());
432 
433  foreach ($this->getProfileMappingFields() as $field => $lng_key) {
434  $this->storage->set('pmap_' . $field, $this->getProfileMappingFieldValue($field));
435  $this->storage->set('pumap_' . $field, (string) ((int) $this->getProfileMappingFieldUpdate($field)));
436  }
437 
438  foreach ($this->udf->getDefinitions() as $definition) {
439  $field = 'udf_' . $definition['field_id'];
440  $this->storage->set('pmap_' . $field, $this->getProfileMappingFieldValue($field));
441  $this->storage->set('pumap_' . $field, (string) ((int) $this->getProfileMappingFieldUpdate($field)));
442  }
443  $this->storage->set('role_mappings', serialize($this->getRoleMappings()));
444  $this->storage->set('validate_scopes', (string) $this->getValidateScopes());
445  if (self::URL_VALIDATION_CUSTOM === $this->getValidateScopes()) {
446  $this->storage->set('custom_discovery_url', $this->getCustomDiscoveryUrl());
447  } else {
448  $this->storage->delete('custom_discovery_url');
449  }
450  }
+ Here is the call graph for this function:

◆ setActive()

ilOpenIdConnectSettings::setActive ( bool  $active)

Definition at line 114 of file class.ilOpenIdConnectSettings.php.

References $active.

Referenced by load().

114  : void
115  {
116  $this->active = $active;
117  }
+ Here is the caller graph for this function:

◆ setAdditionalScopes()

ilOpenIdConnectSettings::setAdditionalScopes ( array  $additional_scopes)
Parameters
list<string>$additional_scopes

Definition at line 265 of file class.ilOpenIdConnectSettings.php.

References $additional_scopes.

Referenced by getSupportedScopesFromUrl(), and load().

265  : void
266  {
267  $this->additional_scopes = $additional_scopes;
268  }
+ Here is the caller graph for this function:

◆ setClientId()

ilOpenIdConnectSettings::setClientId ( string  $client_id)

Definition at line 134 of file class.ilOpenIdConnectSettings.php.

References $client_id.

Referenced by load().

134  : void
135  {
136  $this->client_id = $client_id;
137  }
+ Here is the caller graph for this function:

◆ setCustomDiscoveryUrl()

ilOpenIdConnectSettings::setCustomDiscoveryUrl ( ?string  $discoveryUrl)

Definition at line 532 of file class.ilOpenIdConnectSettings.php.

Referenced by load().

532  : void
533  {
534  $this->custom_discovery_url = $discoveryUrl;
535  }
+ Here is the caller graph for this function:

◆ setLoginElementImage()

ilOpenIdConnectSettings::setLoginElementImage ( string  $a_img_name)

Definition at line 164 of file class.ilOpenIdConnectSettings.php.

Referenced by load().

164  : void
165  {
166  $this->login_element_img_name = $a_img_name;
167  }
+ Here is the caller graph for this function:

◆ setLoginElementText()

ilOpenIdConnectSettings::setLoginElementText ( string  $text)

Definition at line 174 of file class.ilOpenIdConnectSettings.php.

Referenced by load().

174  : void
175  {
176  $this->login_element_text = $text;
177  }
+ Here is the caller graph for this function:

◆ setLoginElementType()

ilOpenIdConnectSettings::setLoginElementType ( int  $type)

Definition at line 154 of file class.ilOpenIdConnectSettings.php.

Referenced by load().

154  : void
155  {
156  $this->login_element_type = $type;
157  }
+ Here is the caller graph for this function:

◆ setLoginPromptType()

ilOpenIdConnectSettings::setLoginPromptType ( int  $a_type)

Definition at line 184 of file class.ilOpenIdConnectSettings.php.

Referenced by load().

184  : void
185  {
186  $this->login_prompt_type = $a_type;
187  }
+ Here is the caller graph for this function:

◆ setLogoutScope()

ilOpenIdConnectSettings::setLogoutScope ( int  $a_scope)

Definition at line 194 of file class.ilOpenIdConnectSettings.php.

Referenced by load().

194  : void
195  {
196  $this->logout_scope = $a_scope;
197  }
+ Here is the caller graph for this function:

◆ setProfileMappingFieldUpdate()

ilOpenIdConnectSettings::setProfileMappingFieldUpdate ( string  $field,
bool  $value 
)

Definition at line 517 of file class.ilOpenIdConnectSettings.php.

517  : void
518  {
519  $this->profile_update_map[$field] = $value;
520  }

◆ setProfileMappingFieldValue()

ilOpenIdConnectSettings::setProfileMappingFieldValue ( string  $field,
string  $value 
)

Definition at line 507 of file class.ilOpenIdConnectSettings.php.

507  : void
508  {
509  $this->profile_map[$field] = $value;
510  }

◆ setProvider()

ilOpenIdConnectSettings::setProvider ( string  $url)

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

References $url.

Referenced by load().

124  : void
125  {
126  $this->provider = $url;
127  }
$url
Definition: shib_logout.php:68
+ Here is the caller graph for this function:

◆ setRole()

ilOpenIdConnectSettings::setRole ( int  $role)

Definition at line 234 of file class.ilOpenIdConnectSettings.php.

References $role.

Referenced by load().

234  : void
235  {
236  $this->role = $role;
237  }
+ Here is the caller graph for this function:

◆ setRoleMappings()

ilOpenIdConnectSettings::setRoleMappings ( array  $a_role_mappings)
Parameters
array<int,array{valuestring, update: bool}> $a_role_mappings

Definition at line 309 of file class.ilOpenIdConnectSettings.php.

Referenced by load().

309  : void
310  {
311  $this->role_mappings = $a_role_mappings;
312  }
+ Here is the caller graph for this function:

◆ setSecret()

ilOpenIdConnectSettings::setSecret ( string  $secret)

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

References $secret.

Referenced by load().

144  : void
145  {
146  $this->secret = $secret;
147  }
+ Here is the caller graph for this function:

◆ setSessionDuration()

ilOpenIdConnectSettings::setSessionDuration ( int  $a_duration)

Definition at line 214 of file class.ilOpenIdConnectSettings.php.

Referenced by load().

214  : void
215  {
216  $this->session_duration = $a_duration;
217  }
+ Here is the caller graph for this function:

◆ setUidField()

ilOpenIdConnectSettings::setUidField ( string  $field)

Definition at line 244 of file class.ilOpenIdConnectSettings.php.

Referenced by load().

244  : void
245  {
246  $this->uid = $field;
247  }
+ Here is the caller graph for this function:

◆ setValidateScopes()

ilOpenIdConnectSettings::setValidateScopes ( int  $validation_mode)

Definition at line 522 of file class.ilOpenIdConnectSettings.php.

Referenced by load().

522  : void
523  {
524  $this->validate_scopes = $validation_mode;
525  }
+ Here is the caller graph for this function:

◆ useCustomSession()

ilOpenIdConnectSettings::useCustomSession ( bool  $a_stat)

Definition at line 204 of file class.ilOpenIdConnectSettings.php.

Referenced by load().

204  : void
205  {
206  $this->custom_session = $a_stat;
207  }
+ Here is the caller graph for this function:

◆ validateScopes()

ilOpenIdConnectSettings::validateScopes ( string  $discoveryURL,
array  $custom_scopes 
)
Parameters
list<string>$custom_scopes
Returns
array{}|array{0: int, 1: list<string>}|array{0: int, 1: string}

Definition at line 344 of file class.ilOpenIdConnectSettings.php.

References $response.

344  : array
345  {
346  $result = [];
347  try {
348  $curl = new ilCurlConnection($discoveryURL);
349  $curl->init();
350 
351  $curl->setOpt(CURLOPT_HEADER, 0);
352  $curl->setOpt(CURLOPT_RETURNTRANSFER, true);
353  $curl->setOpt(CURLOPT_TIMEOUT, 4);
354 
355  $response = $curl->exec();
356 
357  if ($curl->getInfo(CURLINFO_RESPONSE_CODE) === 200) {
358  $decoded_response = json_decode($response, false, 512, JSON_THROW_ON_ERROR);
359  $available_scopes = $decoded_response->scopes_supported;
360  array_unshift($custom_scopes, self::DEFAULT_SCOPE);
361  if (!empty(array_diff($custom_scopes, $available_scopes))) {
362  $result = [
363  self::VALIDATION_ISSUE_INVALID_SCOPE,
364  array_diff($custom_scopes, $available_scopes)
365  ];
366  }
367  } else {
368  $result = [
369  self::VALIDATION_ISSUE_DISCOVERY_ERROR,
370  is_string($response) ? $response : var_export($response, true)
371  ];
372  }
373  } finally {
374  if (isset($curl)) {
375  $curl->close();
376  }
377  }
378 
379  return $result;
380  }
$response
Definition: xapitoken.php:93

Field Documentation

◆ $active

bool ilOpenIdConnectSettings::$active = false
private

Definition at line 67 of file class.ilOpenIdConnectSettings.php.

Referenced by getActive(), and setActive().

◆ $additional_scopes

array ilOpenIdConnectSettings::$additional_scopes = []
private

◆ $allow_sync

bool ilOpenIdConnectSettings::$allow_sync = null
private

Definition at line 78 of file class.ilOpenIdConnectSettings.php.

Referenced by isSyncAllowed().

◆ $client_id

string ilOpenIdConnectSettings::$client_id = ''
private

Definition at line 69 of file class.ilOpenIdConnectSettings.php.

Referenced by getClientId(), and setClientId().

◆ $custom_discovery_url

string ilOpenIdConnectSettings::$custom_discovery_url = null
private

Definition at line 90 of file class.ilOpenIdConnectSettings.php.

Referenced by getCustomDiscoveryUrl().

◆ $custom_session

bool ilOpenIdConnectSettings::$custom_session = false
private

Definition at line 76 of file class.ilOpenIdConnectSettings.php.

Referenced by isCustomSession().

◆ $filesystem

readonly Filesystem ilOpenIdConnectSettings::$filesystem
private

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

◆ $instance

self ilOpenIdConnectSettings::$instance = null
staticprivate

Definition at line 63 of file class.ilOpenIdConnectSettings.php.

◆ $lng

ilLanguage ilOpenIdConnectSettings::$lng
private

Definition at line 91 of file class.ilOpenIdConnectSettings.php.

◆ $login_element_img_name

string ilOpenIdConnectSettings::$login_element_img_name = null
private

Definition at line 72 of file class.ilOpenIdConnectSettings.php.

Referenced by getLoginElementImage().

◆ $login_element_text

string ilOpenIdConnectSettings::$login_element_text = null
private

Definition at line 73 of file class.ilOpenIdConnectSettings.php.

Referenced by getLoginElemenText().

◆ $login_element_type

int ilOpenIdConnectSettings::$login_element_type = self::LOGIN_ELEMENT_TYPE_TXT
private

Definition at line 71 of file class.ilOpenIdConnectSettings.php.

Referenced by getLoginElementType().

◆ $login_prompt_type

int ilOpenIdConnectSettings::$login_prompt_type = self::LOGIN_ENFORCE
private

Definition at line 74 of file class.ilOpenIdConnectSettings.php.

Referenced by getLoginPromptType().

◆ $logout_scope

int ilOpenIdConnectSettings::$logout_scope = null
private

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

Referenced by getLogoutScope().

◆ $profile_map

array ilOpenIdConnectSettings::$profile_map = []
private

Definition at line 82 of file class.ilOpenIdConnectSettings.php.

◆ $profile_update_map

array ilOpenIdConnectSettings::$profile_update_map = []
private

Definition at line 84 of file class.ilOpenIdConnectSettings.php.

◆ $provider

string ilOpenIdConnectSettings::$provider = ''
private

Definition at line 68 of file class.ilOpenIdConnectSettings.php.

Referenced by getProvider().

◆ $role

int ilOpenIdConnectSettings::$role = null
private

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

Referenced by getRole(), and setRole().

◆ $role_mappings

array ilOpenIdConnectSettings::$role_mappings = []
private

Definition at line 86 of file class.ilOpenIdConnectSettings.php.

Referenced by getRoleMappings().

◆ $secret

string ilOpenIdConnectSettings::$secret = ''
private

Definition at line 70 of file class.ilOpenIdConnectSettings.php.

Referenced by getSecret(), and setSecret().

◆ $session_duration

int ilOpenIdConnectSettings::$session_duration = 60
private

Definition at line 77 of file class.ilOpenIdConnectSettings.php.

Referenced by getSessionDuration().

◆ $storage

readonly ilSetting ilOpenIdConnectSettings::$storage
private

Definition at line 65 of file class.ilOpenIdConnectSettings.php.

◆ $udf

ilUserDefinedFields ilOpenIdConnectSettings::$udf
private

Definition at line 92 of file class.ilOpenIdConnectSettings.php.

◆ $uid

string ilOpenIdConnectSettings::$uid = ''
private

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

Referenced by getUidField().

◆ $validate_scopes

int ilOpenIdConnectSettings::$validate_scopes = self::URL_VALIDATION_PROVIDER
private

Definition at line 89 of file class.ilOpenIdConnectSettings.php.

Referenced by getValidateScopes().

◆ DEFAULT_SCOPE

const ilOpenIdConnectSettings::DEFAULT_SCOPE = 'openid'

◆ FILE_STORAGE

const ilOpenIdConnectSettings::FILE_STORAGE = 'openidconnect/login_form_image'

◆ IGNORED_USER_FIELDS

const ilOpenIdConnectSettings::IGNORED_USER_FIELDS
private
Initial value:
= [
'mail_incoming_mail',
'preferences',
'hide_own_online_status',
'show_users_online',
'roles',
'upload',
'password',
'username',
'language',
'skin_style',
'interests_general',
'interests_help_offered',
'interests_help_looking',
'bs_allow_to_contact_me',
'chat_osc_accept_msg',
'chat_broadcast_typing',
]

Definition at line 44 of file class.ilOpenIdConnectSettings.php.

◆ LOGIN_ELEMENT_TYPE_IMG

const ilOpenIdConnectSettings::LOGIN_ELEMENT_TYPE_IMG = 1

◆ LOGIN_ELEMENT_TYPE_TXT

const ilOpenIdConnectSettings::LOGIN_ELEMENT_TYPE_TXT = 0

◆ LOGIN_ENFORCE

const ilOpenIdConnectSettings::LOGIN_ENFORCE = 0

◆ LOGIN_STANDARD

const ilOpenIdConnectSettings::LOGIN_STANDARD = 1

◆ LOGOUT_SCOPE_GLOBAL

const ilOpenIdConnectSettings::LOGOUT_SCOPE_GLOBAL = 0

◆ LOGOUT_SCOPE_LOCAL

const ilOpenIdConnectSettings::LOGOUT_SCOPE_LOCAL = 1

◆ STORAGE_ID

const ilOpenIdConnectSettings::STORAGE_ID = 'oidc'
private

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

◆ URL_VALIDATION_CUSTOM

◆ URL_VALIDATION_NONE

const ilOpenIdConnectSettings::URL_VALIDATION_NONE = 2

◆ URL_VALIDATION_PROVIDER

◆ VALIDATION_ISSUE_DISCOVERY_ERROR

const ilOpenIdConnectSettings::VALIDATION_ISSUE_DISCOVERY_ERROR = 1

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

◆ VALIDATION_ISSUE_INVALID_SCOPE

const ilOpenIdConnectSettings::VALIDATION_ISSUE_INVALID_SCOPE = 0

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