ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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
 
Profile $profile
 

Static Private Attributes

static self $instance = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilOpenIdConnectSettings::__construct ( )
private

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

96 {
97 global $DIC;
98
99 $this->storage = new ilSetting(self::STORAGE_ID);
100 $this->filesystem = $DIC->filesystem()->web();
101 $this->lng = $DIC->language();
102 $this->profile = $DIC['user']->getProfile();
103 $this->load();
104 }
ILIAS Setting Class.
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ allowSync()

ilOpenIdConnectSettings::allowSync ( bool  $a_stat)

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

230 : void
231 {
232 $this->allow_sync = $a_stat;
233 }

Referenced by load().

+ Here is the caller graph for this function:

◆ clearProfileMaps()

ilOpenIdConnectSettings::clearProfileMaps ( )

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

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

◆ deleteImageFile()

ilOpenIdConnectSettings::deleteImageFile ( )

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

282 : void
283 {
284 if ($this->filesystem->has(self::FILE_STORAGE . '/' . $this->getLoginElementImage())) {
285 $this->filesystem->delete(self::FILE_STORAGE . '/' . $this->getLoginElementImage());
286 }
287 }

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

+ Here is the call graph for this function:

◆ getActive()

ilOpenIdConnectSettings::getActive ( )

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

120 : bool
121 {
122 return $this->active;
123 }

References $active.

Referenced by save().

+ Here is the caller graph for this function:

◆ getAdditionalScopes()

ilOpenIdConnectSettings::getAdditionalScopes ( )
Returns
string[]

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

258 : array
259 {
261 }

References $additional_scopes.

Referenced by save().

+ Here is the caller graph for this function:

◆ getAllScopes()

ilOpenIdConnectSettings::getAllScopes ( )
Returns
list<string>

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

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

References $additional_scopes, and $scopes.

◆ getClientId()

ilOpenIdConnectSettings::getClientId ( )

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

140 : string
141 {
142 return $this->client_id;
143 }

References $client_id.

Referenced by save().

+ Here is the caller graph for this function:

◆ getCustomDiscoveryUrl()

ilOpenIdConnectSettings::getCustomDiscoveryUrl ( )

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

538 : ?string
539 {
541 }

References $custom_discovery_url.

Referenced by save().

+ Here is the caller graph for this function:

◆ getImageFilePath()

ilOpenIdConnectSettings::getImageFilePath ( )

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

296 : string
297 {
298 return implode(
299 '/',
300 [
302 self::FILE_STORAGE . '/' . $this->getLoginElementImage()
303 ]
304 );
305 }
static getWebspaceDir(string $mode="filesystem")
get webspace directory

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

+ Here is the call graph for this function:

◆ getInstance()

static ilOpenIdConnectSettings::getInstance ( )
static

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

106 : self
107 {
108 if (self::$instance === null) {
109 self::$instance = new self();
110 }
111
112 return self::$instance;
113 }

References $instance.

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

+ Here is the caller graph for this function:

◆ getLoginElemenText()

ilOpenIdConnectSettings::getLoginElemenText ( )

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

180 : string
181 {
183 }

References $login_element_text.

Referenced by save().

+ Here is the caller graph for this function:

◆ getLoginElementImage()

ilOpenIdConnectSettings::getLoginElementImage ( )

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

170 : string
171 {
173 }

References $login_element_img_name.

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

+ Here is the caller graph for this function:

◆ getLoginElementType()

ilOpenIdConnectSettings::getLoginElementType ( )

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

160 : int
161 {
163 }

References $login_element_type.

Referenced by save().

+ Here is the caller graph for this function:

◆ getLoginPromptType()

ilOpenIdConnectSettings::getLoginPromptType ( )

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

190 : int
191 {
193 }

References $login_prompt_type.

Referenced by save().

+ Here is the caller graph for this function:

◆ getLogoutScope()

ilOpenIdConnectSettings::getLogoutScope ( )

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

200 : int
201 {
202 return $this->logout_scope;
203 }

References $logout_scope.

Referenced by save().

+ Here is the caller graph for this function:

◆ getProfileMappingFields()

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

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

546 : array
547 {
548 $mapping_fields = [];
549
550 foreach ($this->profile->getFields() as $field) {
551 if (in_array($field->getIdentifier(), self::IGNORED_USER_FIELDS, true)) {
552 continue;
553 }
554 $mapping_fields[$field->getIdentifier()] = $this->lng->txt($field->getIdentifier());
555 }
556
557 return $mapping_fields;
558 }

References ILIAS\Repository\lng(), and ILIAS\Repository\profile().

Referenced by load(), and save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProfileMappingFieldUpdate()

ilOpenIdConnectSettings::getProfileMappingFieldUpdate ( string  $field)

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

513 : bool
514 {
515 return (bool) ($this->profile_update_map[$field] ?? false);
516 }

Referenced by save().

+ Here is the caller graph for this function:

◆ getProfileMappingFieldValue()

ilOpenIdConnectSettings::getProfileMappingFieldValue ( string  $field)

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

497 : string
498 {
499 return (string) ($this->profile_map[$field] ?? '');
500 }

Referenced by save().

+ Here is the caller graph for this function:

◆ getProvider()

ilOpenIdConnectSettings::getProvider ( )

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

130 : string
131 {
132 return $this->provider;
133 }

References $provider.

Referenced by save().

+ Here is the caller graph for this function:

◆ getRole()

ilOpenIdConnectSettings::getRole ( )

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

240 : int
241 {
242 return $this->role;
243 }

References $role.

Referenced by save().

+ Here is the caller graph for this function:

◆ getRoleMappings()

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

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

318 : array
319 {
321 }

References $role_mappings.

Referenced by save().

+ Here is the caller graph for this function:

◆ getRoleMappingUpdateForId()

ilOpenIdConnectSettings::getRoleMappingUpdateForId ( int  $a_role_id)

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

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

◆ getRoleMappingValueForId()

ilOpenIdConnectSettings::getRoleMappingValueForId ( int  $a_role_id)

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

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

◆ getSecret()

ilOpenIdConnectSettings::getSecret ( )

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

150 : string
151 {
152 return $this->secret;
153 }

References $secret.

Referenced by save().

+ Here is the caller graph for this function:

◆ getSessionDuration()

ilOpenIdConnectSettings::getSessionDuration ( )

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

220 : int
221 {
223 }

References $session_duration.

Referenced by save().

+ Here is the caller graph for this function:

◆ getSupportedScopesFromUrl()

ilOpenIdConnectSettings::getSupportedScopesFromUrl ( string  $discoveryURL)

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

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

References $response, and setAdditionalScopes().

+ Here is the call graph for this function:

◆ getUidField()

ilOpenIdConnectSettings::getUidField ( )

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

250 : string
251 {
252 return $this->uid;
253 }

References $uid.

Referenced by save().

+ Here is the caller graph for this function:

◆ getValidateScopes()

ilOpenIdConnectSettings::getValidateScopes ( )

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

528 : int
529 {
531 }

References $validate_scopes.

Referenced by load(), and save().

+ Here is the caller graph for this function:

◆ hasImageFile()

ilOpenIdConnectSettings::hasImageFile ( )

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

289 : bool
290 {
291 return
292 $this->getLoginElementImage() !== '' &&
293 $this->filesystem->has(self::FILE_STORAGE . '/' . $this->getLoginElementImage());
294 }

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

+ Here is the call graph for this function:

◆ isCustomSession()

ilOpenIdConnectSettings::isCustomSession ( )

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

210 : bool
211 {
213 }

References $custom_session.

Referenced by save().

+ Here is the caller graph for this function:

◆ isSyncAllowed()

ilOpenIdConnectSettings::isSyncAllowed ( )

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

225 : bool
226 {
227 return $this->allow_sync;
228 }

References $allow_sync.

Referenced by save().

+ Here is the caller graph for this function:

◆ load()

ilOpenIdConnectSettings::load ( )
protected

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

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

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

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilOpenIdConnectSettings::save ( )

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

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

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

+ Here is the call graph for this function:

◆ setActive()

ilOpenIdConnectSettings::setActive ( bool  $active)

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

115 : void
116 {
117 $this->active = $active;
118 }

References $active.

Referenced by load().

+ Here is the caller graph for this function:

◆ setAdditionalScopes()

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

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

266 : void
267 {
268 $this->additional_scopes = $additional_scopes;
269 }

References $additional_scopes.

Referenced by getSupportedScopesFromUrl(), and load().

+ Here is the caller graph for this function:

◆ setClientId()

ilOpenIdConnectSettings::setClientId ( string  $client_id)

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

135 : void
136 {
137 $this->client_id = $client_id;
138 }

References $client_id.

Referenced by load().

+ Here is the caller graph for this function:

◆ setCustomDiscoveryUrl()

ilOpenIdConnectSettings::setCustomDiscoveryUrl ( ?string  $discoveryUrl)

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

533 : void
534 {
535 $this->custom_discovery_url = $discoveryUrl;
536 }

Referenced by load().

+ Here is the caller graph for this function:

◆ setLoginElementImage()

ilOpenIdConnectSettings::setLoginElementImage ( string  $a_img_name)

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

165 : void
166 {
167 $this->login_element_img_name = $a_img_name;
168 }

Referenced by load().

+ Here is the caller graph for this function:

◆ setLoginElementText()

ilOpenIdConnectSettings::setLoginElementText ( string  $text)

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

175 : void
176 {
177 $this->login_element_text = $text;
178 }

Referenced by load().

+ Here is the caller graph for this function:

◆ setLoginElementType()

ilOpenIdConnectSettings::setLoginElementType ( int  $type)

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

155 : void
156 {
157 $this->login_element_type = $type;
158 }

Referenced by load().

+ Here is the caller graph for this function:

◆ setLoginPromptType()

ilOpenIdConnectSettings::setLoginPromptType ( int  $a_type)

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

185 : void
186 {
187 $this->login_prompt_type = $a_type;
188 }

Referenced by load().

+ Here is the caller graph for this function:

◆ setLogoutScope()

ilOpenIdConnectSettings::setLogoutScope ( int  $a_scope)

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

195 : void
196 {
197 $this->logout_scope = $a_scope;
198 }

Referenced by load().

+ Here is the caller graph for this function:

◆ setProfileMappingFieldUpdate()

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

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

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

◆ setProfileMappingFieldValue()

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

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

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

◆ setProvider()

ilOpenIdConnectSettings::setProvider ( string  $url)

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

125 : void
126 {
127 $this->provider = $url;
128 }
$url
Definition: shib_logout.php:68

References $url.

Referenced by load().

+ Here is the caller graph for this function:

◆ setRole()

ilOpenIdConnectSettings::setRole ( int  $role)

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

235 : void
236 {
237 $this->role = $role;
238 }

References $role.

Referenced by load().

+ 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 310 of file class.ilOpenIdConnectSettings.php.

310 : void
311 {
312 $this->role_mappings = $a_role_mappings;
313 }

Referenced by load().

+ Here is the caller graph for this function:

◆ setSecret()

ilOpenIdConnectSettings::setSecret ( string  $secret)

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

145 : void
146 {
147 $this->secret = $secret;
148 }

References $secret.

Referenced by load().

+ Here is the caller graph for this function:

◆ setSessionDuration()

ilOpenIdConnectSettings::setSessionDuration ( int  $a_duration)

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

215 : void
216 {
217 $this->session_duration = $a_duration;
218 }

Referenced by load().

+ Here is the caller graph for this function:

◆ setUidField()

ilOpenIdConnectSettings::setUidField ( string  $field)

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

245 : void
246 {
247 $this->uid = $field;
248 }

Referenced by load().

+ Here is the caller graph for this function:

◆ setValidateScopes()

ilOpenIdConnectSettings::setValidateScopes ( int  $validation_mode)

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

523 : void
524 {
525 $this->validate_scopes = $validation_mode;
526 }

Referenced by load().

+ Here is the caller graph for this function:

◆ useCustomSession()

ilOpenIdConnectSettings::useCustomSession ( bool  $a_stat)

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

205 : void
206 {
207 $this->custom_session = $a_stat;
208 }

Referenced by load().

+ 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 345 of file class.ilOpenIdConnectSettings.php.

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

References $response, VALIDATION_ISSUE_DISCOVERY_ERROR, and VALIDATION_ISSUE_INVALID_SCOPE.

Field Documentation

◆ $active

bool ilOpenIdConnectSettings::$active = false
private

Definition at line 68 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 79 of file class.ilOpenIdConnectSettings.php.

Referenced by isSyncAllowed().

◆ $client_id

string ilOpenIdConnectSettings::$client_id = ''
private

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

Referenced by getClientId(), and setClientId().

◆ $custom_discovery_url

string ilOpenIdConnectSettings::$custom_discovery_url = null
private

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

Referenced by getCustomDiscoveryUrl().

◆ $custom_session

bool ilOpenIdConnectSettings::$custom_session = false
private

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

Referenced by isCustomSession().

◆ $filesystem

readonly Filesystem ilOpenIdConnectSettings::$filesystem
private

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

◆ $instance

self ilOpenIdConnectSettings::$instance = null
staticprivate

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

Referenced by getInstance().

◆ $lng

ilLanguage ilOpenIdConnectSettings::$lng
private

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

◆ $login_element_img_name

string ilOpenIdConnectSettings::$login_element_img_name = null
private

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

Referenced by getLoginElementImage().

◆ $login_element_text

string ilOpenIdConnectSettings::$login_element_text = null
private

Definition at line 74 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 72 of file class.ilOpenIdConnectSettings.php.

Referenced by getLoginElementType().

◆ $login_prompt_type

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

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

Referenced by getLoginPromptType().

◆ $logout_scope

int ilOpenIdConnectSettings::$logout_scope = null
private

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

Referenced by getLogoutScope().

◆ $profile

Profile ilOpenIdConnectSettings::$profile
private

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

◆ $profile_map

array ilOpenIdConnectSettings::$profile_map = []
private

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

◆ $profile_update_map

array ilOpenIdConnectSettings::$profile_update_map = []
private

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

◆ $provider

string ilOpenIdConnectSettings::$provider = ''
private

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

Referenced by getProvider().

◆ $role

int ilOpenIdConnectSettings::$role = null
private

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

Referenced by getRole(), and setRole().

◆ $role_mappings

array ilOpenIdConnectSettings::$role_mappings = []
private

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

Referenced by getRoleMappings().

◆ $secret

string ilOpenIdConnectSettings::$secret = ''
private

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

Referenced by getSecret(), and setSecret().

◆ $session_duration

int ilOpenIdConnectSettings::$session_duration = 60
private

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

Referenced by getSessionDuration().

◆ $storage

readonly ilSetting ilOpenIdConnectSettings::$storage
private

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

◆ $uid

string ilOpenIdConnectSettings::$uid = ''
private

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

Referenced by getUidField().

◆ $validate_scopes

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

Definition at line 90 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 45 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 26 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 42 of file class.ilOpenIdConnectSettings.php.

Referenced by validateScopes().

◆ VALIDATION_ISSUE_INVALID_SCOPE

const ilOpenIdConnectSettings::VALIDATION_ISSUE_INVALID_SCOPE = 0

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