Commit | Line | Data |
---|---|---|
7b617429 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | Copyright CiviCRM LLC. All rights reserved. | | |
5 | | | | |
6 | | This work is published under the GNU AGPLv3 license with some | | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
9 | +--------------------------------------------------------------------+ | |
10 | */ | |
11 | ||
12 | use CRM_Authx_ExtensionUtil as E; | |
13 | ||
14 | /** | |
15 | * | |
16 | * @package CRM | |
17 | * @copyright CiviCRM LLC https://civicrm.org/licensing | |
18 | */ | |
53951784 | 19 | $_authx_settings = function() { |
d0528c96 | 20 | $flows = ['param', 'header', 'xheader', 'login', 'auto']; |
7b617429 TO |
21 | $basic = [ |
22 | 'group_name' => 'CiviCRM Preferences', | |
23 | 'group' => 'authx', | |
24 | 'is_domain' => 1, | |
25 | 'is_contact' => 0, | |
26 | 'add' => '5.36', | |
27 | ]; | |
28 | ||
29 | $s = []; | |
a0956f3c TO |
30 | $s["authx_guards"] = $basic + [ |
31 | 'name' => 'authx_guards', | |
32 | 'type' => 'Array', | |
33 | 'quick_form_type' => 'Select', | |
34 | 'html_type' => 'Select', | |
35 | 'html_attributes' => [ | |
36 | 'multiple' => 1, | |
37 | 'class' => 'crm-select2', | |
38 | ], | |
39 | 'default' => ['site_key', 'perm'], | |
40 | 'title' => ts('Authentication guard'), | |
41 | 'help_text' => ts('Enable an authentication guard if you want to limit which users may authenticate via authx. The permission-based guard is satisfied by checking user permissions. The key-based guard is satisfied by checking the secret site-key. The JWT guard is satisfied if the user presents a signed token. If there are no guards, then any user can authenticate.'), | |
42 | 'pseudoconstant' => [ | |
43 | 'callback' => ['\Civi\Authx\Meta', 'getGuardTypes'], | |
44 | ], | |
45 | ]; | |
7b617429 TO |
46 | foreach ($flows as $flow) { |
47 | $s["authx_{$flow}_cred"] = $basic + [ | |
48 | 'name' => "authx_{$flow}_cred", | |
49 | 'type' => 'Array', | |
50 | 'quick_form_type' => 'Select', | |
51 | 'html_type' => 'Select', | |
52 | 'html_attributes' => [ | |
53 | 'multiple' => 1, | |
54 | 'class' => 'crm-select2', | |
55 | ], | |
56 | 'default' => ['jwt'], | |
7dcba4e2 | 57 | 'title' => ts('Acceptable credentials (%1)', [1 => $flow]), |
7b617429 TO |
58 | 'help_text' => NULL, |
59 | 'pseudoconstant' => [ | |
60 | 'callback' => ['\Civi\Authx\Meta', 'getCredentialTypes'], | |
61 | ], | |
62 | ]; | |
63 | $s["authx_{$flow}_user"] = $basic + [ | |
64 | 'name' => "authx_{$flow}_user", | |
65 | 'type' => 'String', | |
66 | 'quick_form_type' => 'Select', | |
67 | 'html_type' => 'Select', | |
68 | 'html_attributes' => [ | |
69 | 'class' => 'crm-select2', | |
70 | ], | |
71 | 'default' => 'optional', | |
7dcba4e2 | 72 | 'title' => ts('User account requirements (%1)', [1 => $flow]), |
7b617429 TO |
73 | 'help_text' => NULL, |
74 | 'pseudoconstant' => [ | |
75 | 'callback' => ['\Civi\Authx\Meta', 'getUserModes'], | |
76 | ], | |
77 | ]; | |
78 | } | |
79 | return $s; | |
53951784 | 80 | }; |
7b617429 TO |
81 | |
82 | /** | |
83 | * Settings metadata file | |
84 | */ | |
53951784 | 85 | return $_authx_settings(); |