ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilOpenIdAttributeMappingTemplates.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
23  final public const OPEN_ID_CONFIGURED_SCOPES = 'auth_oidc_configured_scopes';
24 
29  public function getMappingRulesByAdditionalScopes(array $additional_scopes): array
30  {
31  $mapping_rule = [];
32 
33  if (in_array('address', $additional_scopes)) {
34  $mapping_rule = $this->loadAddress($mapping_rule);
35  }
36  if (in_array('email', $additional_scopes)) {
37  $mapping_rule = $this->loadEmail($mapping_rule);
38  }
39  if (in_array('phone', $additional_scopes)) {
40  $mapping_rule = $this->loadPhone($mapping_rule);
41  }
42  if (in_array('profile', $additional_scopes)) {
43  $mapping_rule = $this->loadProfile($mapping_rule);
44  }
45 
46  return $mapping_rule;
47  }
48 
53  private function loadProfile(array $mapping_rule): array
54  {
55  $mapping_rule['lastname'] = 'family_name';
56  $mapping_rule['firstname'] = 'given_name';
57  $mapping_rule['login'] = 'preferred_username';
58  $mapping_rule['gender'] = 'gender';
59  $mapping_rule['birthday'] = 'birthdate';
60 
61  return $mapping_rule;
62  }
63 
68  private function loadEmail(array $mapping_rule): array
69  {
70  $mapping_rule['email'] = 'email';
71 
72  return $mapping_rule;
73  }
74 
79  private function loadAddress(array $mapping_rule): array
80  {
81  $mapping_rule['street'] = 'street_address';
82  $mapping_rule['city'] = 'locality';
83  $mapping_rule['zipcode'] = 'postal_code';
84  $mapping_rule['country'] = 'country';
85 
86  return $mapping_rule;
87  }
88 
93  private function loadPhone(array $mapping_rule): array
94  {
95  $mapping_rule['phone_home'] = 'phone_number';
96 
97  return $mapping_rule;
98  }
99 }