PluginProbe
Authorizer / 3.9.1
Authorizer v3.9.1
3.16.0 3.15.3 3.15.2 3.15.1 3.15.0 3.14.3 3.14.4 3.14.2 3.14.1 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.10 2.9.11 2.9.12 2.9.13 2.9.2 2.9.3 All 127 releases
← All changes | src/authorizer/class-options.php +67 -775 3.15.03.9.1 View file →
@@ -10,11 +10,8 @@
10 10 namespace Authorizer;
11 11
12 12 use Authorizer\Helper;
13 13
14 -// Prevent direct access.
15 -defined( 'ABSPATH' ) || exit;
16 -
17 14 /**
18 15 * Contains functions for rendering the Access Lists tab in Authorizer Settings.
19 16 */
20 17 class Options extends Singleton {
@@ -78,18 +75,8 @@
78 75 if ( 'access_who_can_login' === $option || 'access_who_can_view' === $option ) {
79 76 $tab = '&tab=access_lists';
80 77 } elseif ( 0 === strpos( $option, 'advanced_' ) ) {
81 78 $tab = '&tab=advanced';
82 - } elseif ( str_starts_with( $option, 'oauth2_' ) ) {
83 - $tab = '&tab=external_oauth2';
84 - } elseif ( str_starts_with( $option, 'oidc_' ) ) {
85 - $tab = '&tab=external_oidc';
86 - } elseif ( str_starts_with( $option, 'google_' ) ) {
87 - $tab = '&tab=external_google';
88 - } elseif ( str_starts_with( $option, 'cas_' ) ) {
89 - $tab = '&tab=external_cas';
90 - } elseif ( str_starts_with( $option, 'ldap_' ) ) {
91 - $tab = '&tab=external_ldap';
92 79 }
93 80 ?>
94 81 <div id="overlay-hide-auth_settings_<?php echo esc_attr( $option ); ?>" class="auth_multisite_override_overlay">
95 82 <span class="overlay-note">
@@ -178,131 +165,37 @@
178 165 * $approved_users = $options->get( 'access_users_approved', Helper::SINGLE_CONTEXT );
179 166 * $ms_approved_users = $options->get( 'access_users_approved', Helper::NETWORK_CONTEXT );
180 167 */
181 168
182 - // Override external service (Oauth2) and associated options.
183 - $auth_settings['oauth2'] = $auth_multisite_settings['oauth2'];
184 - $auth_settings['oauth2_auto_login'] = $auth_multisite_settings['oauth2_auto_login'] ?? '';
185 - $auth_settings['oauth2_num_servers'] = $auth_multisite_settings['oauth2_num_servers'] ?? 1;
186 - $auth_settings['oauth2_provider'] = $auth_multisite_settings['oauth2_provider'] ?? '';
187 - $auth_settings['oauth2_custom_label'] = $auth_multisite_settings['oauth2_custom_label'] ?? 'OAuth2';
188 - $auth_settings['oauth2_clientid'] = $auth_multisite_settings['oauth2_clientid'] ?? '';
189 - $auth_settings['oauth2_clientsecret'] = $auth_multisite_settings['oauth2_clientsecret'] ?? '';
190 - $auth_settings['oauth2_hosteddomain'] = $auth_multisite_settings['oauth2_hosteddomain'] ?? '';
191 - $auth_settings['oauth2_tenant_id'] = $auth_multisite_settings['oauth2_tenant_id'] ?? '';
192 - $auth_settings['oauth2_url_authorize'] = $auth_multisite_settings['oauth2_url_authorize'] ?? '';
193 - $auth_settings['oauth2_url_token'] = $auth_multisite_settings['oauth2_url_token'] ?? '';
194 - $auth_settings['oauth2_url_resource'] = $auth_multisite_settings['oauth2_url_resource'] ?? '';
195 - $auth_settings['oauth2_attr_username'] = $auth_multisite_settings['oauth2_attr_username'] ?? '';
196 - $auth_settings['oauth2_attr_email'] = $auth_multisite_settings['oauth2_attr_email'] ?? '';
197 - $auth_settings['oauth2_attr_first_name'] = $auth_multisite_settings['oauth2_attr_first_name'] ?? '';
198 - $auth_settings['oauth2_attr_last_name'] = $auth_multisite_settings['oauth2_attr_last_name'] ?? '';
199 - $auth_settings['oauth2_attr_update_on_login'] = $auth_multisite_settings['oauth2_attr_update_on_login'] ?? '';
200 - $auth_settings['oauth2_link_on_username'] = $auth_multisite_settings['oauth2_link_on_username'] ?? '';
201 - // Add any options for extra OAuth2 servers.
202 - if ( ! empty( $auth_multisite_settings['oauth2_num_servers'] ) && intval( $auth_multisite_settings['oauth2_num_servers'] ) > 1 ) {
203 - foreach ( range( 2, min( intval( $auth_multisite_settings['oauth2_num_servers'] ), 20 ) ) as $oauth2_num_server ) {
204 - $auth_settings[ 'oauth2_provider_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_provider_' . $oauth2_num_server ] ?? '';
205 - $auth_settings[ 'oauth2_custom_label_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_custom_label_' . $oauth2_num_server ] ?? 'OAuth2';
206 - $auth_settings[ 'oauth2_clientid_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_clientid_' . $oauth2_num_server ] ?? '';
207 - $auth_settings[ 'oauth2_clientsecret_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_clientsecret_' . $oauth2_num_server ] ?? '';
208 - $auth_settings[ 'oauth2_hosteddomain_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_hosteddomain_' . $oauth2_num_server ] ?? '';
209 - $auth_settings[ 'oauth2_tenant_id_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_tenant_id_' . $oauth2_num_server ] ?? '';
210 - $auth_settings[ 'oauth2_url_authorize_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_url_authorize_' . $oauth2_num_server ] ?? '';
211 - $auth_settings[ 'oauth2_url_token_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_url_token_' . $oauth2_num_server ] ?? '';
212 - $auth_settings[ 'oauth2_url_resource_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_url_resource_' . $oauth2_num_server ] ?? '';
213 - $auth_settings[ 'oauth2_attr_username_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_attr_username_' . $oauth2_num_server ] ?? '';
214 - $auth_settings[ 'oauth2_attr_email_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_attr_email_' . $oauth2_num_server ] ?? '';
215 - $auth_settings[ 'oauth2_attr_first_name_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_attr_first_name_' . $oauth2_num_server ] ?? '';
216 - $auth_settings[ 'oauth2_attr_last_name_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_attr_last_name_' . $oauth2_num_server ] ?? '';
217 - $auth_settings[ 'oauth2_attr_update_on_login_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_attr_update_on_login_' . $oauth2_num_server ] ?? '';
218 - $auth_settings[ 'oauth2_link_on_username_' . $oauth2_num_server ] = $auth_multisite_settings[ 'oauth2_link_on_username_' . $oauth2_num_server ] ?? '';
219 - }
220 - }
221 -
222 - // Override external service (OIDC) and associated options.
223 - $auth_settings['oidc'] = $auth_multisite_settings['oidc'] ?? '';
224 - $auth_settings['oidc_num_servers'] = $auth_multisite_settings['oidc_num_servers'] ?? 1;
225 - $auth_settings['oidc_auto_login'] = $auth_multisite_settings['oidc_auto_login'] ?? '';
226 - $auth_settings['oidc_custom_label'] = $auth_multisite_settings['oidc_custom_label'] ?? 'OIDC';
227 - $auth_settings['oidc_issuer'] = $auth_multisite_settings['oidc_issuer'] ?? '';
228 - $auth_settings['oidc_client_id'] = $auth_multisite_settings['oidc_client_id'] ?? '';
229 - $auth_settings['oidc_client_secret'] = $auth_multisite_settings['oidc_client_secret'] ?? '';
230 - $auth_settings['oidc_scopes'] = $auth_multisite_settings['oidc_scopes'] ?? 'openid email profile';
231 - $auth_settings['oidc_prompt'] = $auth_multisite_settings['oidc_prompt'] ?? '';
232 - $auth_settings['oidc_login_hint'] = $auth_multisite_settings['oidc_login_hint'] ?? '';
233 - $auth_settings['oidc_max_age'] = $auth_multisite_settings['oidc_max_age'] ?? '';
234 - $auth_settings['oidc_attr_username'] = $auth_multisite_settings['oidc_attr_username'] ?? 'preferred_username';
235 - $auth_settings['oidc_attr_email'] = $auth_multisite_settings['oidc_attr_email'] ?? 'email';
236 - $auth_settings['oidc_attr_first_name'] = $auth_multisite_settings['oidc_attr_first_name'] ?? 'given_name';
237 - $auth_settings['oidc_attr_last_name'] = $auth_multisite_settings['oidc_attr_last_name'] ?? 'family_name';
238 - $auth_settings['oidc_attr_update_on_login'] = $auth_multisite_settings['oidc_attr_update_on_login'] ?? '';
239 - $auth_settings['oidc_force_auth_method'] = $auth_multisite_settings['oidc_force_auth_method'] ?? '';
240 - $auth_settings['oidc_require_verified_email'] = $auth_multisite_settings['oidc_require_verified_email'] ?? '';
241 - $auth_settings['oidc_link_on_username'] = $auth_multisite_settings['oidc_link_on_username'] ?? '';
242 - $auth_settings['oidc_hosteddomain'] = $auth_multisite_settings['oidc_hosteddomain'] ?? '';
243 - // Add any options for extra OIDC servers.
244 - if ( ! empty( $auth_multisite_settings['oidc_num_servers'] ) && intval( $auth_multisite_settings['oidc_num_servers'] ) > 1 ) {
245 - foreach ( range( 2, min( intval( $auth_multisite_settings['oidc_num_servers'] ), 20 ) ) as $oidc_num_server ) {
246 - $auth_settings[ 'oidc_custom_label_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_custom_label_' . $oidc_num_server ] ?? 'OIDC';
247 - $auth_settings[ 'oidc_issuer_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_issuer_' . $oidc_num_server ] ?? '';
248 - $auth_settings[ 'oidc_client_id_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_client_id_' . $oidc_num_server ] ?? '';
249 - $auth_settings[ 'oidc_client_secret_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_client_secret_' . $oidc_num_server ] ?? '';
250 - $auth_settings[ 'oidc_scopes_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_scopes_' . $oidc_num_server ] ?? 'openid email profile';
251 - $auth_settings[ 'oidc_prompt_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_prompt_' . $oidc_num_server ] ?? '';
252 - $auth_settings[ 'oidc_login_hint_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_login_hint_' . $oidc_num_server ] ?? '';
253 - $auth_settings[ 'oidc_max_age_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_max_age_' . $oidc_num_server ] ?? '';
254 - $auth_settings[ 'oidc_attr_username_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_attr_username_' . $oidc_num_server ] ?? 'preferred_username';
255 - $auth_settings[ 'oidc_attr_email_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_attr_email_' . $oidc_num_server ] ?? 'email';
256 - $auth_settings[ 'oidc_attr_first_name_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_attr_first_name_' . $oidc_num_server ] ?? 'given_name';
257 - $auth_settings[ 'oidc_attr_last_name_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_attr_last_name_' . $oidc_num_server ] ?? 'family_name';
258 - $auth_settings[ 'oidc_attr_update_on_login_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_attr_update_on_login_' . $oidc_num_server ] ?? '';
259 - $auth_settings[ 'oidc_force_auth_method_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_force_auth_method_' . $oidc_num_server ] ?? '';
260 - $auth_settings[ 'oidc_require_verified_email_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_require_verified_email_' . $oidc_num_server ] ?? '';
261 - $auth_settings[ 'oidc_link_on_username_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_link_on_username_' . $oidc_num_server ] ?? '';
262 - $auth_settings[ 'oidc_hosteddomain_' . $oidc_num_server ] = $auth_multisite_settings[ 'oidc_hosteddomain_' . $oidc_num_server ] ?? '';
263 - }
264 - }
265 -
266 - // Override external service (Google) and associated options.
267 - $auth_settings['google'] = $auth_multisite_settings['google'];
268 - $auth_settings['google_clientid'] = $auth_multisite_settings['google_clientid'];
269 - $auth_settings['google_clientsecret'] = $auth_multisite_settings['google_clientsecret'];
270 - $auth_settings['google_hosteddomain'] = $auth_multisite_settings['google_hosteddomain'];
271 -
272 - // Override external service (CAS) and associated options.
273 - $auth_settings['cas'] = $auth_multisite_settings['cas'];
274 - $auth_settings['cas_auto_login'] = $auth_multisite_settings['cas_auto_login'];
275 - $auth_settings['cas_num_servers'] = $auth_multisite_settings['cas_num_servers'] ?? 1;
276 - $auth_settings['cas_custom_label'] = $auth_multisite_settings['cas_custom_label'];
277 - $auth_settings['cas_host'] = $auth_multisite_settings['cas_host'];
278 - $auth_settings['cas_port'] = $auth_multisite_settings['cas_port'];
279 - $auth_settings['cas_path'] = $auth_multisite_settings['cas_path'];
280 - $auth_settings['cas_method'] = $auth_multisite_settings['cas_method'];
281 - $auth_settings['cas_version'] = $auth_multisite_settings['cas_version'];
282 - $auth_settings['cas_attr_email'] = $auth_multisite_settings['cas_attr_email'];
283 - $auth_settings['cas_attr_first_name'] = $auth_multisite_settings['cas_attr_first_name'];
284 - $auth_settings['cas_attr_last_name'] = $auth_multisite_settings['cas_attr_last_name'];
285 - $auth_settings['cas_attr_update_on_login'] = $auth_multisite_settings['cas_attr_update_on_login'];
286 - $auth_settings['cas_link_on_username'] = $auth_multisite_settings['cas_link_on_username'];
287 - // Add any options for extra CAS servers.
288 - if ( ! empty( $auth_multisite_settings['cas_num_servers'] ) && intval( $auth_multisite_settings['cas_num_servers'] ) > 1 ) {
289 - foreach ( range( 2, min( intval( $auth_multisite_settings['cas_num_servers'] ), 10 ) ) as $cas_num_server ) {
290 - $auth_settings[ 'cas_custom_label_' . $cas_num_server ] = $auth_multisite_settings[ 'cas_custom_label_' . $cas_num_server ] ?? 'CAS';
291 - $auth_settings[ 'cas_host_' . $cas_num_server ] = $auth_multisite_settings[ 'cas_host_' . $cas_num_server ] ?? '';
292 - $auth_settings[ 'cas_port_' . $cas_num_server ] = $auth_multisite_settings[ 'cas_port_' . $cas_num_server ] ?? '';
293 - $auth_settings[ 'cas_path_' . $cas_num_server ] = $auth_multisite_settings[ 'cas_path_' . $cas_num_server ] ?? '';
294 - $auth_settings[ 'cas_method_' . $cas_num_server ] = $auth_multisite_settings[ 'cas_method_' . $cas_num_server ] ?? Options\External\Cas::get_instance()->sanitize_cas_method();
295 - $auth_settings[ 'cas_version_' . $cas_num_server ] = $auth_multisite_settings[ 'cas_version_' . $cas_num_server ] ?? Options\External\Cas::get_instance()->sanitize_cas_version();
296 - $auth_settings[ 'cas_attr_email_' . $cas_num_server ] = $auth_multisite_settings[ 'cas_attr_email_' . $cas_num_server ] ?? '';
297 - $auth_settings[ 'cas_attr_first_name_' . $cas_num_server ] = $auth_multisite_settings[ 'cas_attr_first_name_' . $cas_num_server ] ?? '';
298 - $auth_settings[ 'cas_attr_last_name_' . $cas_num_server ] = $auth_multisite_settings[ 'cas_attr_last_name_' . $cas_num_server ] ?? '';
299 - $auth_settings[ 'cas_attr_update_on_login_' . $cas_num_server ] = $auth_multisite_settings[ 'cas_attr_update_on_login_' . $cas_num_server ] ?? '';
300 - $auth_settings[ 'cas_link_on_username_' . $cas_num_server ] = $auth_multisite_settings[ 'cas_link_on_username_' . $cas_num_server ] ?? '';
301 - }
302 - }
303 -
304 - // Override external service (LDAP) and associated options.
169 + // Override external services (google, cas, or ldap) and associated options.
170 + $auth_settings['oauth2'] = $auth_multisite_settings['oauth2'];
171 + $auth_settings['oauth2_provider'] = $auth_multisite_settings['oauth2_provider'];
172 + $auth_settings['oauth2_custom_label'] = $auth_multisite_settings['oauth2_custom_label'];
173 + $auth_settings['oauth2_clientid'] = $auth_multisite_settings['oauth2_clientid'];
174 + $auth_settings['oauth2_clientsecret'] = $auth_multisite_settings['oauth2_clientsecret'];
175 + $auth_settings['oauth2_hosteddomain'] = $auth_multisite_settings['oauth2_hosteddomain'];
176 + $auth_settings['oauth2_tenant_id'] = $auth_multisite_settings['oauth2_tenant_id'];
177 + $auth_settings['oauth2_url_authorize'] = $auth_multisite_settings['oauth2_url_authorize'];
178 + $auth_settings['oauth2_url_token'] = $auth_multisite_settings['oauth2_url_token'];
179 + $auth_settings['oauth2_url_resource'] = $auth_multisite_settings['oauth2_url_resource'];
180 + $auth_settings['oauth2_auto_login'] = $auth_multisite_settings['oauth2_auto_login'] ?? '';
181 + $auth_settings['google'] = $auth_multisite_settings['google'];
182 + $auth_settings['google_clientid'] = $auth_multisite_settings['google_clientid'];
183 + $auth_settings['google_clientsecret'] = $auth_multisite_settings['google_clientsecret'];
184 + $auth_settings['google_hosteddomain'] = $auth_multisite_settings['google_hosteddomain'];
185 + $auth_settings['cas'] = $auth_multisite_settings['cas'];
186 + $auth_settings['cas_auto_login'] = $auth_multisite_settings['cas_auto_login'];
187 + $auth_settings['cas_custom_label'] = $auth_multisite_settings['cas_custom_label'];
188 + $auth_settings['cas_host'] = $auth_multisite_settings['cas_host'];
189 + $auth_settings['cas_port'] = $auth_multisite_settings['cas_port'];
190 + $auth_settings['cas_path'] = $auth_multisite_settings['cas_path'];
191 + $auth_settings['cas_method'] = $auth_multisite_settings['cas_method'];
192 + $auth_settings['cas_version'] = $auth_multisite_settings['cas_version'];
193 + $auth_settings['cas_attr_email'] = $auth_multisite_settings['cas_attr_email'];
194 + $auth_settings['cas_attr_first_name'] = $auth_multisite_settings['cas_attr_first_name'];
195 + $auth_settings['cas_attr_last_name'] = $auth_multisite_settings['cas_attr_last_name'];
196 + $auth_settings['cas_attr_update_on_login'] = $auth_multisite_settings['cas_attr_update_on_login'];
197 + $auth_settings['cas_link_on_username'] = $auth_multisite_settings['cas_link_on_username'];
305 198 $auth_settings['ldap'] = $auth_multisite_settings['ldap'];
306 199 $auth_settings['ldap_host'] = $auth_multisite_settings['ldap_host'];
307 200 $auth_settings['ldap_port'] = $auth_multisite_settings['ldap_port'];
308 201 $auth_settings['ldap_tls'] = $auth_multisite_settings['ldap_tls'];
@@ -333,11 +226,8 @@
333 226
334 227 // Override Disable WordPress login.
335 228 $auth_settings['advanced_disable_wp_login'] = $auth_multisite_settings['advanced_disable_wp_login'];
336 229
337 - // Override bypass users.
338 - $auth_settings['advanced_disable_wp_login_bypass_usernames'] = $auth_multisite_settings['advanced_disable_wp_login_bypass_usernames'] ?? '';
339 -
340 230 // Override Users per page.
341 231 $auth_settings['advanced_users_per_page'] = $auth_multisite_settings['advanced_users_per_page'];
342 232
343 233 // Override Sort users by.
@@ -345,11 +235,8 @@
345 235
346 236 // Override Sort users order.
347 237 $auth_settings['advanced_users_sort_order'] = $auth_multisite_settings['advanced_users_sort_order'];
348 238
349 - // Override Show usernames in approved users list.
350 - $auth_settings['advanced_show_usernames'] = $auth_multisite_settings['advanced_show_usernames'] ?? '';
351 -
352 239 // Override Show Dashboard Widget.
353 240 $auth_settings['advanced_widget_enabled'] = $auth_multisite_settings['advanced_widget_enabled'];
354 241 }
355 242 }
@@ -404,11 +291,8 @@
404 291 }
405 292 if ( ! array_key_exists( 'access_role_receive_pending_emails', $auth_settings ) ) {
406 293 $auth_settings['access_role_receive_pending_emails'] = '---';
407 294 }
408 - if ( ! array_key_exists( 'access_users_receive_pending_emails', $auth_settings ) ) {
409 - $auth_settings['access_users_receive_pending_emails'] = array();
410 - }
411 295 if ( ! array_key_exists( 'access_pending_redirect_to_message', $auth_settings ) ) {
412 296 $auth_settings['access_pending_redirect_to_message'] = '<p>' . __( "You're not currently allowed to view this site. Your administrator has been notified, and once he/she has approved your request, you will be able to log in. If you need any other help, please contact your administrator.", 'authorizer' ) . '</p>';
413 297 }
414 298 if ( ! array_key_exists( 'access_blocked_redirect_to_message', $auth_settings ) ) {
@@ -466,14 +350,28 @@
466 350
467 351 if ( ! array_key_exists( 'oauth2', $auth_settings ) ) {
468 352 $auth_settings['oauth2'] = '';
469 353 }
470 - if ( ! array_key_exists( 'oauth2_auto_login', $auth_settings ) ) {
471 - $auth_settings['oauth2_auto_login'] = '';
354 + if ( ! array_key_exists( 'google', $auth_settings ) ) {
355 + $auth_settings['google'] = '';
472 356 }
473 - if ( ! array_key_exists( 'oauth2_num_servers', $auth_settings ) ) {
474 - $auth_settings['oauth2_num_servers'] = '1';
357 + if ( ! array_key_exists( 'cas', $auth_settings ) ) {
358 + $auth_settings['cas'] = '';
475 359 }
360 + if ( ! array_key_exists( 'ldap', $auth_settings ) ) {
361 + $auth_settings['ldap'] = '';
362 + }
363 +
364 + if ( ! array_key_exists( 'google_clientid', $auth_settings ) ) {
365 + $auth_settings['google_clientid'] = '';
366 + }
367 + if ( ! array_key_exists( 'google_clientsecret', $auth_settings ) ) {
368 + $auth_settings['google_clientsecret'] = '';
369 + }
370 + if ( ! array_key_exists( 'google_hosteddomain', $auth_settings ) ) {
371 + $auth_settings['google_hosteddomain'] = '';
372 + }
373 +
476 374 if ( ! array_key_exists( 'oauth2_provider', $auth_settings ) ) {
477 375 $auth_settings['oauth2_provider'] = '';
478 376 }
479 377 if ( ! array_key_exists( 'oauth2_custom_label', $auth_settings ) ) {
@@ -499,216 +397,15 @@
499 397 }
500 398 if ( ! array_key_exists( 'oauth2_url_resource', $auth_settings ) ) {
501 399 $auth_settings['oauth2_url_resource'] = '';
502 400 }
503 - if ( ! array_key_exists( 'oauth2_attr_username', $auth_settings ) ) {
504 - $auth_settings['oauth2_attr_username'] = '';
401 + if ( ! array_key_exists( 'oauth2_auto_login', $auth_settings ) ) {
402 + $auth_settings['oauth2_auto_login'] = '';
505 403 }
506 - if ( ! array_key_exists( 'oauth2_attr_email', $auth_settings ) ) {
507 - $auth_settings['oauth2_attr_email'] = '';
508 - }
509 - if ( ! array_key_exists( 'oauth2_attr_first_name', $auth_settings ) ) {
510 - $auth_settings['oauth2_attr_first_name'] = '';
511 - }
512 - if ( ! array_key_exists( 'oauth2_attr_last_name', $auth_settings ) ) {
513 - $auth_settings['oauth2_attr_last_name'] = '';
514 - }
515 - if ( ! array_key_exists( 'oauth2_attr_update_on_login', $auth_settings ) ) {
516 - $auth_settings['oauth2_attr_update_on_login'] = '';
517 - }
518 - if ( ! array_key_exists( 'oauth2_link_on_username', $auth_settings ) ) {
519 - $auth_settings['oauth2_link_on_username'] = '';
520 - }
521 - if ( intval( $auth_settings['oauth2_num_servers'] ) > 1 ) {
522 - foreach ( range( 2, min( intval( $auth_settings['oauth2_num_servers'] ), 20 ) ) as $oauth2_num_server ) {
523 - if ( ! array_key_exists( 'oauth2_provider_' . $oauth2_num_server, $auth_settings ) ) {
524 - $auth_settings[ 'oauth2_provider_' . $oauth2_num_server ] = '';
525 - }
526 - if ( ! array_key_exists( 'oauth2_custom_label_' . $oauth2_num_server, $auth_settings ) ) {
527 - $auth_settings[ 'oauth2_custom_label_' . $oauth2_num_server ] = 'OAuth2';
528 - }
529 - if ( ! array_key_exists( 'oauth2_clientid_' . $oauth2_num_server, $auth_settings ) ) {
530 - $auth_settings[ 'oauth2_clientid_' . $oauth2_num_server ] = '';
531 - }
532 - if ( ! array_key_exists( 'oauth2_clientsecret_' . $oauth2_num_server, $auth_settings ) ) {
533 - $auth_settings[ 'oauth2_clientsecret_' . $oauth2_num_server ] = '';
534 - }
535 - if ( ! array_key_exists( 'oauth2_hosteddomain_' . $oauth2_num_server, $auth_settings ) ) {
536 - $auth_settings[ 'oauth2_hosteddomain_' . $oauth2_num_server ] = '';
537 - }
538 - if ( ! array_key_exists( 'oauth2_tenant_id_' . $oauth2_num_server, $auth_settings ) ) {
539 - $auth_settings[ 'oauth2_tenant_id_' . $oauth2_num_server ] = 'common';
540 - }
541 - if ( ! array_key_exists( 'oauth2_url_authorize_' . $oauth2_num_server, $auth_settings ) ) {
542 - $auth_settings[ 'oauth2_url_authorize_' . $oauth2_num_server ] = '';
543 - }
544 - if ( ! array_key_exists( 'oauth2_url_token_' . $oauth2_num_server, $auth_settings ) ) {
545 - $auth_settings[ 'oauth2_url_token_' . $oauth2_num_server ] = '';
546 - }
547 - if ( ! array_key_exists( 'oauth2_url_resource_' . $oauth2_num_server, $auth_settings ) ) {
548 - $auth_settings[ 'oauth2_url_resource_' . $oauth2_num_server ] = '';
549 - }
550 - if ( ! array_key_exists( 'oauth2_attr_username_' . $oauth2_num_server, $auth_settings ) ) {
551 - $auth_settings[ 'oauth2_attr_username_' . $oauth2_num_server ] = '';
552 - }
553 - if ( ! array_key_exists( 'oauth2_attr_email_' . $oauth2_num_server, $auth_settings ) ) {
554 - $auth_settings[ 'oauth2_attr_email_' . $oauth2_num_server ] = '';
555 - }
556 - if ( ! array_key_exists( 'oauth2_attr_first_name_' . $oauth2_num_server, $auth_settings ) ) {
557 - $auth_settings[ 'oauth2_attr_first_name_' . $oauth2_num_server ] = '';
558 - }
559 - if ( ! array_key_exists( 'oauth2_attr_last_name_' . $oauth2_num_server, $auth_settings ) ) {
560 - $auth_settings[ 'oauth2_attr_last_name_' . $oauth2_num_server ] = '';
561 - }
562 - if ( ! array_key_exists( 'oauth2_attr_update_on_login_' . $oauth2_num_server, $auth_settings ) ) {
563 - $auth_settings[ 'oauth2_attr_update_on_login_' . $oauth2_num_server ] = '';
564 - }
565 - if ( ! array_key_exists( 'oauth2_link_on_username_' . $oauth2_num_server, $auth_settings ) ) {
566 - $auth_settings[ 'oauth2_link_on_username_' . $oauth2_num_server ] = '';
567 - }
568 - }
569 - }
570 404
571 - if ( ! array_key_exists( 'oidc', $auth_settings ) ) {
572 - $auth_settings['oidc'] = '';
573 - }
574 - if ( ! array_key_exists( 'oidc_custom_label', $auth_settings ) ) {
575 - $auth_settings['oidc_custom_label'] = 'OIDC';
576 - }
577 - if ( ! array_key_exists( 'oidc_issuer', $auth_settings ) ) {
578 - $auth_settings['oidc_issuer'] = '';
579 - }
580 - if ( ! array_key_exists( 'oidc_client_id', $auth_settings ) ) {
581 - $auth_settings['oidc_client_id'] = '';
582 - }
583 - if ( ! array_key_exists( 'oidc_client_secret', $auth_settings ) ) {
584 - $auth_settings['oidc_client_secret'] = '';
585 - }
586 - if ( ! array_key_exists( 'oidc_scopes', $auth_settings ) ) {
587 - $auth_settings['oidc_scopes'] = 'openid email profile';
588 - }
589 - if ( ! array_key_exists( 'oidc_prompt', $auth_settings ) ) {
590 - $auth_settings['oidc_prompt'] = '';
591 - }
592 - if ( ! array_key_exists( 'oidc_login_hint', $auth_settings ) ) {
593 - $auth_settings['oidc_login_hint'] = '';
594 - }
595 - if ( ! array_key_exists( 'oidc_max_age', $auth_settings ) ) {
596 - $auth_settings['oidc_max_age'] = '';
597 - }
598 - if ( ! array_key_exists( 'oidc_attr_username', $auth_settings ) ) {
599 - $auth_settings['oidc_attr_username'] = 'preferred_username';
600 - }
601 - if ( ! array_key_exists( 'oidc_attr_email', $auth_settings ) ) {
602 - $auth_settings['oidc_attr_email'] = 'email';
603 - }
604 - if ( ! array_key_exists( 'oidc_attr_first_name', $auth_settings ) ) {
605 - $auth_settings['oidc_attr_first_name'] = 'given_name';
606 - }
607 - if ( ! array_key_exists( 'oidc_attr_last_name', $auth_settings ) ) {
608 - $auth_settings['oidc_attr_last_name'] = 'family_name';
609 - }
610 - if ( ! array_key_exists( 'oidc_attr_update_on_login', $auth_settings ) ) {
611 - $auth_settings['oidc_attr_update_on_login'] = '';
612 - }
613 - if ( ! array_key_exists( 'oidc_force_auth_method', $auth_settings ) ) {
614 - $auth_settings['oidc_force_auth_method'] = '';
615 - }
616 - if ( ! array_key_exists( 'oidc_require_verified_email', $auth_settings ) ) {
617 - $auth_settings['oidc_require_verified_email'] = '';
618 - }
619 - if ( ! array_key_exists( 'oidc_link_on_username', $auth_settings ) ) {
620 - $auth_settings['oidc_link_on_username'] = '';
621 - }
622 - if ( ! array_key_exists( 'oidc_hosteddomain', $auth_settings ) ) {
623 - $auth_settings['oidc_hosteddomain'] = '';
624 - }
625 - if ( ! array_key_exists( 'oidc_num_servers', $auth_settings ) ) {
626 - $auth_settings['oidc_num_servers'] = '1';
627 - }
628 - if ( ! array_key_exists( 'oidc_auto_login', $auth_settings ) ) {
629 - $auth_settings['oidc_auto_login'] = '';
630 - }
631 -
632 - // Add any options for extra OIDC servers.
633 - if ( intval( $auth_settings['oidc_num_servers'] ) > 1 ) {
634 - foreach ( range( 2, min( intval( $auth_settings['oidc_num_servers'] ), 20 ) ) as $oidc_num_server ) {
635 - if ( ! array_key_exists( 'oidc_custom_label_' . $oidc_num_server, $auth_settings ) ) {
636 - $auth_settings[ 'oidc_custom_label_' . $oidc_num_server ] = 'OIDC';
637 - }
638 - if ( ! array_key_exists( 'oidc_issuer_' . $oidc_num_server, $auth_settings ) ) {
639 - $auth_settings[ 'oidc_issuer_' . $oidc_num_server ] = '';
640 - }
641 - if ( ! array_key_exists( 'oidc_client_id_' . $oidc_num_server, $auth_settings ) ) {
642 - $auth_settings[ 'oidc_client_id_' . $oidc_num_server ] = '';
643 - }
644 - if ( ! array_key_exists( 'oidc_client_secret_' . $oidc_num_server, $auth_settings ) ) {
645 - $auth_settings[ 'oidc_client_secret_' . $oidc_num_server ] = '';
646 - }
647 - if ( ! array_key_exists( 'oidc_scopes_' . $oidc_num_server, $auth_settings ) ) {
648 - $auth_settings[ 'oidc_scopes_' . $oidc_num_server ] = 'openid email profile';
649 - }
650 - if ( ! array_key_exists( 'oidc_prompt_' . $oidc_num_server, $auth_settings ) ) {
651 - $auth_settings[ 'oidc_prompt_' . $oidc_num_server ] = '';
652 - }
653 - if ( ! array_key_exists( 'oidc_login_hint_' . $oidc_num_server, $auth_settings ) ) {
654 - $auth_settings[ 'oidc_login_hint_' . $oidc_num_server ] = '';
655 - }
656 - if ( ! array_key_exists( 'oidc_max_age_' . $oidc_num_server, $auth_settings ) ) {
657 - $auth_settings[ 'oidc_max_age_' . $oidc_num_server ] = '';
658 - }
659 - if ( ! array_key_exists( 'oidc_attr_username_' . $oidc_num_server, $auth_settings ) ) {
660 - $auth_settings[ 'oidc_attr_username_' . $oidc_num_server ] = 'preferred_username';
661 - }
662 - if ( ! array_key_exists( 'oidc_attr_email_' . $oidc_num_server, $auth_settings ) ) {
663 - $auth_settings[ 'oidc_attr_email_' . $oidc_num_server ] = 'email';
664 - }
665 - if ( ! array_key_exists( 'oidc_attr_first_name_' . $oidc_num_server, $auth_settings ) ) {
666 - $auth_settings[ 'oidc_attr_first_name_' . $oidc_num_server ] = 'given_name';
667 - }
668 - if ( ! array_key_exists( 'oidc_attr_last_name_' . $oidc_num_server, $auth_settings ) ) {
669 - $auth_settings[ 'oidc_attr_last_name_' . $oidc_num_server ] = 'family_name';
670 - }
671 - if ( ! array_key_exists( 'oidc_attr_update_on_login_' . $oidc_num_server, $auth_settings ) ) {
672 - $auth_settings[ 'oidc_attr_update_on_login_' . $oidc_num_server ] = '';
673 - }
674 - if ( ! array_key_exists( 'oidc_force_auth_method_' . $oidc_num_server, $auth_settings ) ) {
675 - $auth_settings[ 'oidc_force_auth_method_' . $oidc_num_server ] = '';
676 - }
677 - if ( ! array_key_exists( 'oidc_require_verified_email_' . $oidc_num_server, $auth_settings ) ) {
678 - $auth_settings[ 'oidc_require_verified_email_' . $oidc_num_server ] = '';
679 - }
680 - if ( ! array_key_exists( 'oidc_link_on_username_' . $oidc_num_server, $auth_settings ) ) {
681 - $auth_settings[ 'oidc_link_on_username_' . $oidc_num_server ] = '';
682 - }
683 - if ( ! array_key_exists( 'oidc_hosteddomain_' . $oidc_num_server, $auth_settings ) ) {
684 - $auth_settings[ 'oidc_hosteddomain_' . $oidc_num_server ] = '';
685 - }
686 - }
687 - }
688 -
689 - if ( ! array_key_exists( 'google', $auth_settings ) ) {
690 - $auth_settings['google'] = '';
691 - }
692 - if ( ! array_key_exists( 'google_clientid', $auth_settings ) ) {
693 - $auth_settings['google_clientid'] = '';
694 - }
695 - if ( ! array_key_exists( 'google_clientsecret', $auth_settings ) ) {
696 - $auth_settings['google_clientsecret'] = '';
697 - }
698 - if ( ! array_key_exists( 'google_hosteddomain', $auth_settings ) ) {
699 - $auth_settings['google_hosteddomain'] = '';
700 - }
701 -
702 - if ( ! array_key_exists( 'cas', $auth_settings ) ) {
703 - $auth_settings['cas'] = '';
704 - }
705 405 if ( ! array_key_exists( 'cas_auto_login', $auth_settings ) ) {
706 406 $auth_settings['cas_auto_login'] = '';
707 407 }
708 - if ( ! array_key_exists( 'cas_num_servers', $auth_settings ) ) {
709 - $auth_settings['cas_num_servers'] = '1';
710 - }
711 408 if ( ! array_key_exists( 'cas_custom_label', $auth_settings ) ) {
712 409 $auth_settings['cas_custom_label'] = 'CAS';
713 410 }
714 411 if ( ! array_key_exists( 'cas_host', $auth_settings ) ) {
@@ -740,49 +437,9 @@
740 437 }
741 438 if ( ! array_key_exists( 'cas_link_on_username', $auth_settings ) ) {
742 439 $auth_settings['cas_link_on_username'] = '';
743 440 }
744 - if ( intval( $auth_settings['cas_num_servers'] ) > 1 ) {
745 - foreach ( range( 2, min( intval( $auth_settings['cas_num_servers'] ), 10 ) ) as $cas_num_server ) {
746 - if ( ! array_key_exists( 'cas_custom_label_' . $cas_num_server, $auth_settings ) ) {
747 - $auth_settings[ 'cas_custom_label_' . $cas_num_server ] = 'CAS';
748 - }
749 - if ( ! array_key_exists( 'cas_host_' . $cas_num_server, $auth_settings ) ) {
750 - $auth_settings[ 'cas_host_' . $cas_num_server ] = '';
751 - }
752 - if ( ! array_key_exists( 'cas_port_' . $cas_num_server, $auth_settings ) ) {
753 - $auth_settings[ 'cas_port_' . $cas_num_server ] = '';
754 - }
755 - if ( ! array_key_exists( 'cas_path_' . $cas_num_server, $auth_settings ) ) {
756 - $auth_settings[ 'cas_path_' . $cas_num_server ] = '';
757 - }
758 - if ( ! array_key_exists( 'cas_method_' . $cas_num_server, $auth_settings ) ) {
759 - $auth_settings[ 'cas_method_' . $cas_num_server ] = Options\External\Cas::get_instance()->sanitize_cas_method();
760 - }
761 - if ( ! array_key_exists( 'cas_version_' . $cas_num_server, $auth_settings ) ) {
762 - $auth_settings[ 'cas_version_' . $cas_num_server ] = Options\External\Cas::get_instance()->sanitize_cas_version();
763 - }
764 - if ( ! array_key_exists( 'cas_attr_email_' . $cas_num_server, $auth_settings ) ) {
765 - $auth_settings[ 'cas_attr_email_' . $cas_num_server ] = '';
766 - }
767 - if ( ! array_key_exists( 'cas_attr_first_name_' . $cas_num_server, $auth_settings ) ) {
768 - $auth_settings[ 'cas_attr_first_name_' . $cas_num_server ] = '';
769 - }
770 - if ( ! array_key_exists( 'cas_attr_last_name_' . $cas_num_server, $auth_settings ) ) {
771 - $auth_settings[ 'cas_attr_last_name_' . $cas_num_server ] = '';
772 - }
773 - if ( ! array_key_exists( 'cas_attr_update_on_login_' . $cas_num_server, $auth_settings ) ) {
774 - $auth_settings[ 'cas_attr_update_on_login_' . $cas_num_server ] = '';
775 - }
776 - if ( ! array_key_exists( 'cas_link_on_username_' . $cas_num_server, $auth_settings ) ) {
777 - $auth_settings[ 'cas_link_on_username_' . $cas_num_server ] = '';
778 - }
779 - }
780 - }
781 441
782 - if ( ! array_key_exists( 'ldap', $auth_settings ) ) {
783 - $auth_settings['ldap'] = '';
784 - }
785 442 if ( ! array_key_exists( 'ldap_host', $auth_settings ) ) {
786 443 $auth_settings['ldap_host'] = '';
787 444 }
788 445 if ( ! array_key_exists( 'ldap_port', $auth_settings ) ) {
@@ -840,11 +497,8 @@
840 497 }
841 498 if ( ! array_key_exists( 'advanced_disable_wp_login', $auth_settings ) ) {
842 499 $auth_settings['advanced_disable_wp_login'] = '';
843 500 }
844 - if ( ! array_key_exists( 'advanced_disable_wp_login_bypass_usernames', $auth_settings ) ) {
845 - $auth_settings['advanced_disable_wp_login_bypass_usernames'] = '';
846 - }
847 501 if ( ! array_key_exists( 'advanced_branding', $auth_settings ) ) {
848 502 $auth_settings['advanced_branding'] = 'default';
849 503 }
850 504 if ( ! array_key_exists( 'advanced_admin_menu', $auth_settings ) ) {
@@ -861,11 +515,8 @@
861 515 }
862 516 if ( ! array_key_exists( 'advanced_users_sort_order', $auth_settings ) ) {
863 517 $auth_settings['advanced_users_sort_order'] = 'asc';
864 518 }
865 - if ( ! array_key_exists( 'advanced_show_usernames', $auth_settings ) ) {
866 - $auth_settings['advanced_show_usernames'] = '';
867 - }
868 519 if ( ! array_key_exists( 'advanced_widget_enabled', $auth_settings ) ) {
869 520 $auth_settings['advanced_widget_enabled'] = '1';
870 521 }
871 522 if ( ! array_key_exists( 'advanced_override_multisite', $auth_settings ) ) {
@@ -872,12 +523,12 @@
872 523 $auth_settings['advanced_override_multisite'] = '';
873 524 }
874 525
875 526 // Save default options to database.
876 - update_option( 'auth_settings', $auth_settings, true );
877 - update_option( 'auth_settings_access_users_pending', $auth_settings_access_users_pending, false );
878 - update_option( 'auth_settings_access_users_approved', $auth_settings_access_users_approved, false );
879 - update_option( 'auth_settings_access_users_blocked', $auth_settings_access_users_blocked, false );
527 + update_option( 'auth_settings', $auth_settings );
528 + update_option( 'auth_settings_access_users_pending', $auth_settings_access_users_pending );
529 + update_option( 'auth_settings_access_users_approved', $auth_settings_access_users_approved );
530 + update_option( 'auth_settings_access_users_blocked', $auth_settings_access_users_blocked );
880 531
881 532 // Multisite defaults.
882 533 if ( is_multisite() && $args['set_multisite_options'] ) {
883 534 $auth_multisite_settings = get_blog_option( get_main_site_id( get_main_network_id() ), 'auth_multisite_settings', array() );
@@ -920,14 +571,17 @@
920 571 }
921 572 if ( ! array_key_exists( 'oauth2', $auth_multisite_settings ) ) {
922 573 $auth_multisite_settings['oauth2'] = '';
923 574 }
924 - if ( ! array_key_exists( 'oauth2_auto_login', $auth_multisite_settings ) ) {
925 - $auth_multisite_settings['oauth2_auto_login'] = '';
575 + if ( ! array_key_exists( 'google', $auth_multisite_settings ) ) {
576 + $auth_multisite_settings['google'] = '';
926 577 }
927 - if ( ! array_key_exists( 'oauth2_num_servers', $auth_multisite_settings ) ) {
928 - $auth_multisite_settings['oauth2_num_servers'] = '1';
578 + if ( ! array_key_exists( 'cas', $auth_multisite_settings ) ) {
579 + $auth_multisite_settings['cas'] = '';
929 580 }
581 + if ( ! array_key_exists( 'ldap', $auth_multisite_settings ) ) {
582 + $auth_multisite_settings['ldap'] = '';
583 + }
930 584 if ( ! array_key_exists( 'oauth2_provider', $auth_multisite_settings ) ) {
931 585 $auth_multisite_settings['oauth2_provider'] = '';
932 586 }
933 587 if ( ! array_key_exists( 'oauth2_custom_label', $auth_multisite_settings ) ) {
@@ -953,193 +607,11 @@
953 607 }
954 608 if ( ! array_key_exists( 'oauth2_url_resource', $auth_multisite_settings ) ) {
955 609 $auth_multisite_settings['oauth2_url_resource'] = '';
956 610 }
957 - if ( ! array_key_exists( 'oauth2_attr_username', $auth_multisite_settings ) ) {
958 - $auth_multisite_settings['oauth2_attr_username'] = '';
611 + if ( ! array_key_exists( 'oauth2_auto_login', $auth_multisite_settings ) ) {
612 + $auth_multisite_settings['oauth2_auto_login'] = '';
959 613 }
960 - if ( ! array_key_exists( 'oauth2_attr_email', $auth_multisite_settings ) ) {
961 - $auth_multisite_settings['oauth2_attr_email'] = '';
962 - }
963 - if ( ! array_key_exists( 'oauth2_attr_first_name', $auth_multisite_settings ) ) {
964 - $auth_multisite_settings['oauth2_attr_first_name'] = '';
965 - }
966 - if ( ! array_key_exists( 'oauth2_attr_last_name', $auth_multisite_settings ) ) {
967 - $auth_multisite_settings['oauth2_attr_last_name'] = '';
968 - }
969 - if ( ! array_key_exists( 'oauth2_attr_update_on_login', $auth_multisite_settings ) ) {
970 - $auth_multisite_settings['oauth2_attr_update_on_login'] = '';
971 - }
972 - if ( ! array_key_exists( 'oauth2_link_on_username', $auth_multisite_settings ) ) {
973 - $auth_multisite_settings['oauth2_link_on_username'] = '';
974 - }
975 - if ( intval( $auth_multisite_settings['oauth2_num_servers'] ) > 1 ) {
976 - foreach ( range( 2, min( intval( $auth_multisite_settings['oauth2_num_servers'] ), 20 ) ) as $oauth2_num_server ) {
977 - if ( ! array_key_exists( 'oauth2_provider_' . $oauth2_num_server, $auth_multisite_settings ) ) {
978 - $auth_multisite_settings[ 'oauth2_provider_' . $oauth2_num_server ] = '';
979 - }
980 - if ( ! array_key_exists( 'oauth2_custom_label_' . $oauth2_num_server, $auth_multisite_settings ) ) {
981 - $auth_multisite_settings[ 'oauth2_custom_label_' . $oauth2_num_server ] = 'OAuth2';
982 - }
983 - if ( ! array_key_exists( 'oauth2_clientid_' . $oauth2_num_server, $auth_multisite_settings ) ) {
984 - $auth_multisite_settings[ 'oauth2_clientid_' . $oauth2_num_server ] = '';
985 - }
986 - if ( ! array_key_exists( 'oauth2_clientsecret_' . $oauth2_num_server, $auth_multisite_settings ) ) {
987 - $auth_multisite_settings[ 'oauth2_clientsecret_' . $oauth2_num_server ] = '';
988 - }
989 - if ( ! array_key_exists( 'oauth2_hosteddomain_' . $oauth2_num_server, $auth_multisite_settings ) ) {
990 - $auth_multisite_settings[ 'oauth2_hosteddomain_' . $oauth2_num_server ] = '';
991 - }
992 - if ( ! array_key_exists( 'oauth2_tenant_id_' . $oauth2_num_server, $auth_multisite_settings ) ) {
993 - $auth_multisite_settings[ 'oauth2_tenant_id_' . $oauth2_num_server ] = 'common';
994 - }
995 - if ( ! array_key_exists( 'oauth2_url_authorize_' . $oauth2_num_server, $auth_multisite_settings ) ) {
996 - $auth_multisite_settings[ 'oauth2_url_authorize_' . $oauth2_num_server ] = '';
997 - }
998 - if ( ! array_key_exists( 'oauth2_url_token_' . $oauth2_num_server, $auth_multisite_settings ) ) {
999 - $auth_multisite_settings[ 'oauth2_url_token_' . $oauth2_num_server ] = '';
1000 - }
1001 - if ( ! array_key_exists( 'oauth2_url_resource_' . $oauth2_num_server, $auth_multisite_settings ) ) {
1002 - $auth_multisite_settings[ 'oauth2_url_resource_' . $oauth2_num_server ] = '';
1003 - }
1004 - if ( ! array_key_exists( 'oauth2_attr_username_' . $oauth2_num_server, $auth_multisite_settings ) ) {
1005 - $auth_multisite_settings[ 'oauth2_attr_username_' . $oauth2_num_server ] = '';
1006 - }
1007 - if ( ! array_key_exists( 'oauth2_attr_email_' . $oauth2_num_server, $auth_multisite_settings ) ) {
1008 - $auth_multisite_settings[ 'oauth2_attr_email_' . $oauth2_num_server ] = '';
1009 - }
1010 - if ( ! array_key_exists( 'oauth2_attr_first_name_' . $oauth2_num_server, $auth_multisite_settings ) ) {
1011 - $auth_multisite_settings[ 'oauth2_attr_first_name_' . $oauth2_num_server ] = '';
1012 - }
1013 - if ( ! array_key_exists( 'oauth2_attr_last_name_' . $oauth2_num_server, $auth_multisite_settings ) ) {
1014 - $auth_multisite_settings[ 'oauth2_attr_last_name_' . $oauth2_num_server ] = '';
1015 - }
1016 - if ( ! array_key_exists( 'oauth2_attr_update_on_login_' . $oauth2_num_server, $auth_multisite_settings ) ) {
1017 - $auth_multisite_settings[ 'oauth2_attr_update_on_login_' . $oauth2_num_server ] = '';
1018 - }
1019 - if ( ! array_key_exists( 'oauth2_link_on_username_' . $oauth2_num_server, $auth_multisite_settings ) ) {
1020 - $auth_multisite_settings[ 'oauth2_link_on_username_' . $oauth2_num_server ] = '';
1021 - }
1022 - }
1023 - }
1024 - if ( ! array_key_exists( 'oidc', $auth_multisite_settings ) ) {
1025 - $auth_multisite_settings['oidc'] = '';
1026 - }
1027 - if ( ! array_key_exists( 'oidc_num_servers', $auth_multisite_settings ) ) {
1028 - $auth_multisite_settings['oidc_num_servers'] = '1';
1029 - }
1030 - if ( ! array_key_exists( 'oidc_auto_login', $auth_multisite_settings ) ) {
1031 - $auth_multisite_settings['oidc_auto_login'] = '';
1032 - }
1033 - if ( ! array_key_exists( 'oidc_custom_label', $auth_multisite_settings ) ) {
1034 - $auth_multisite_settings['oidc_custom_label'] = 'OIDC';
1035 - }
1036 - if ( ! array_key_exists( 'oidc_issuer', $auth_multisite_settings ) ) {
1037 - $auth_multisite_settings['oidc_issuer'] = '';
1038 - }
1039 - if ( ! array_key_exists( 'oidc_client_id', $auth_multisite_settings ) ) {
1040 - $auth_multisite_settings['oidc_client_id'] = '';
1041 - }
1042 - if ( ! array_key_exists( 'oidc_client_secret', $auth_multisite_settings ) ) {
1043 - $auth_multisite_settings['oidc_client_secret'] = '';
1044 - }
1045 - if ( ! array_key_exists( 'oidc_scopes', $auth_multisite_settings ) ) {
1046 - $auth_multisite_settings['oidc_scopes'] = 'openid email profile';
1047 - }
1048 - if ( ! array_key_exists( 'oidc_prompt', $auth_multisite_settings ) ) {
1049 - $auth_multisite_settings['oidc_prompt'] = '';
1050 - }
1051 - if ( ! array_key_exists( 'oidc_login_hint', $auth_multisite_settings ) ) {
1052 - $auth_multisite_settings['oidc_login_hint'] = '';
1053 - }
1054 - if ( ! array_key_exists( 'oidc_max_age', $auth_multisite_settings ) ) {
1055 - $auth_multisite_settings['oidc_max_age'] = '';
1056 - }
1057 - if ( ! array_key_exists( 'oidc_attr_username', $auth_multisite_settings ) ) {
1058 - $auth_multisite_settings['oidc_attr_username'] = 'preferred_username';
1059 - }
1060 - if ( ! array_key_exists( 'oidc_attr_email', $auth_multisite_settings ) ) {
1061 - $auth_multisite_settings['oidc_attr_email'] = 'email';
1062 - }
1063 - if ( ! array_key_exists( 'oidc_attr_first_name', $auth_multisite_settings ) ) {
1064 - $auth_multisite_settings['oidc_attr_first_name'] = 'given_name';
1065 - }
1066 - if ( ! array_key_exists( 'oidc_attr_last_name', $auth_multisite_settings ) ) {
1067 - $auth_multisite_settings['oidc_attr_last_name'] = 'family_name';
1068 - }
1069 - if ( ! array_key_exists( 'oidc_attr_update_on_login', $auth_multisite_settings ) ) {
1070 - $auth_multisite_settings['oidc_attr_update_on_login'] = '';
1071 - }
1072 - if ( ! array_key_exists( 'oidc_force_auth_method', $auth_multisite_settings ) ) {
1073 - $auth_multisite_settings['oidc_force_auth_method'] = '';
1074 - }
1075 - if ( ! array_key_exists( 'oidc_require_verified_email', $auth_multisite_settings ) ) {
1076 - $auth_multisite_settings['oidc_require_verified_email'] = '';
1077 - }
1078 - if ( ! array_key_exists( 'oidc_link_on_username', $auth_multisite_settings ) ) {
1079 - $auth_multisite_settings['oidc_link_on_username'] = '';
1080 - }
1081 - if ( ! array_key_exists( 'oidc_hosteddomain', $auth_multisite_settings ) ) {
1082 - $auth_multisite_settings['oidc_hosteddomain'] = '';
1083 - }
1084 - if ( intval( $auth_multisite_settings['oidc_num_servers'] ) > 1 ) {
1085 - foreach ( range( 2, min( intval( $auth_multisite_settings['oidc_num_servers'] ), 20 ) ) as $oidc_num_server ) {
1086 - if ( ! array_key_exists( 'oidc_custom_label_' . $oidc_num_server, $auth_multisite_settings ) ) {
1087 - $auth_multisite_settings[ 'oidc_custom_label_' . $oidc_num_server ] = 'OIDC';
1088 - }
1089 - if ( ! array_key_exists( 'oidc_issuer_' . $oidc_num_server, $auth_multisite_settings ) ) {
1090 - $auth_multisite_settings[ 'oidc_issuer_' . $oidc_num_server ] = '';
1091 - }
1092 - if ( ! array_key_exists( 'oidc_client_id_' . $oidc_num_server, $auth_multisite_settings ) ) {
1093 - $auth_multisite_settings[ 'oidc_client_id_' . $oidc_num_server ] = '';
1094 - }
1095 - if ( ! array_key_exists( 'oidc_client_secret_' . $oidc_num_server, $auth_multisite_settings ) ) {
1096 - $auth_multisite_settings[ 'oidc_client_secret_' . $oidc_num_server ] = '';
1097 - }
1098 - if ( ! array_key_exists( 'oidc_scopes_' . $oidc_num_server, $auth_multisite_settings ) ) {
1099 - $auth_multisite_settings[ 'oidc_scopes_' . $oidc_num_server ] = 'openid email profile';
1100 - }
1101 - if ( ! array_key_exists( 'oidc_prompt_' . $oidc_num_server, $auth_multisite_settings ) ) {
1102 - $auth_multisite_settings[ 'oidc_prompt_' . $oidc_num_server ] = '';
1103 - }
1104 - if ( ! array_key_exists( 'oidc_login_hint_' . $oidc_num_server, $auth_multisite_settings ) ) {
1105 - $auth_multisite_settings[ 'oidc_login_hint_' . $oidc_num_server ] = '';
1106 - }
1107 - if ( ! array_key_exists( 'oidc_max_age_' . $oidc_num_server, $auth_multisite_settings ) ) {
1108 - $auth_multisite_settings[ 'oidc_max_age_' . $oidc_num_server ] = '';
1109 - }
1110 - if ( ! array_key_exists( 'oidc_attr_username_' . $oidc_num_server, $auth_multisite_settings ) ) {
1111 - $auth_multisite_settings[ 'oidc_attr_username_' . $oidc_num_server ] = 'preferred_username';
1112 - }
1113 - if ( ! array_key_exists( 'oidc_attr_email_' . $oidc_num_server, $auth_multisite_settings ) ) {
1114 - $auth_multisite_settings[ 'oidc_attr_email_' . $oidc_num_server ] = 'email';
1115 - }
1116 - if ( ! array_key_exists( 'oidc_attr_first_name_' . $oidc_num_server, $auth_multisite_settings ) ) {
1117 - $auth_multisite_settings[ 'oidc_attr_first_name_' . $oidc_num_server ] = 'given_name';
1118 - }
1119 - if ( ! array_key_exists( 'oidc_attr_last_name_' . $oidc_num_server, $auth_multisite_settings ) ) {
1120 - $auth_multisite_settings[ 'oidc_attr_last_name_' . $oidc_num_server ] = 'family_name';
1121 - }
1122 - if ( ! array_key_exists( 'oidc_attr_update_on_login_' . $oidc_num_server, $auth_multisite_settings ) ) {
1123 - $auth_multisite_settings[ 'oidc_attr_update_on_login_' . $oidc_num_server ] = '';
1124 - }
1125 - if ( ! array_key_exists( 'oidc_force_auth_method_' . $oidc_num_server, $auth_multisite_settings ) ) {
1126 - $auth_multisite_settings[ 'oidc_force_auth_method_' . $oidc_num_server ] = '';
1127 - }
1128 - if ( ! array_key_exists( 'oidc_require_verified_email_' . $oidc_num_server, $auth_multisite_settings ) ) {
1129 - $auth_multisite_settings[ 'oidc_require_verified_email_' . $oidc_num_server ] = '';
1130 - }
1131 - if ( ! array_key_exists( 'oidc_link_on_username_' . $oidc_num_server, $auth_multisite_settings ) ) {
1132 - $auth_multisite_settings[ 'oidc_link_on_username_' . $oidc_num_server ] = '';
1133 - }
1134 - if ( ! array_key_exists( 'oidc_hosteddomain_' . $oidc_num_server, $auth_multisite_settings ) ) {
1135 - $auth_multisite_settings[ 'oidc_hosteddomain_' . $oidc_num_server ] = '';
1136 - }
1137 - }
1138 - }
1139 - if ( ! array_key_exists( 'google', $auth_multisite_settings ) ) {
1140 - $auth_multisite_settings['google'] = '';
1141 - }
1142 614 if ( ! array_key_exists( 'google_clientid', $auth_multisite_settings ) ) {
1143 615 $auth_multisite_settings['google_clientid'] = '';
1144 616 }
1145 617 if ( ! array_key_exists( 'google_clientsecret', $auth_multisite_settings ) ) {
@@ -1147,17 +619,11 @@
1147 619 }
1148 620 if ( ! array_key_exists( 'google_hosteddomain', $auth_multisite_settings ) ) {
1149 621 $auth_multisite_settings['google_hosteddomain'] = '';
1150 622 }
1151 - if ( ! array_key_exists( 'cas', $auth_multisite_settings ) ) {
1152 - $auth_multisite_settings['cas'] = '';
1153 - }
1154 623 if ( ! array_key_exists( 'cas_auto_login', $auth_multisite_settings ) ) {
1155 624 $auth_multisite_settings['cas_auto_login'] = '';
1156 625 }
1157 - if ( ! array_key_exists( 'cas_num_servers', $auth_multisite_settings ) ) {
1158 - $auth_multisite_settings['cas_num_servers'] = '1';
1159 - }
1160 626 if ( ! array_key_exists( 'cas_custom_label', $auth_multisite_settings ) ) {
1161 627 $auth_multisite_settings['cas_custom_label'] = 'CAS';
1162 628 }
1163 629 if ( ! array_key_exists( 'cas_host', $auth_multisite_settings ) ) {
@@ -1189,48 +655,8 @@
1189 655 }
1190 656 if ( ! array_key_exists( 'cas_link_on_username', $auth_multisite_settings ) ) {
1191 657 $auth_multisite_settings['cas_link_on_username'] = '';
1192 658 }
1193 - if ( intval( $auth_multisite_settings['cas_num_servers'] ) > 1 ) {
1194 - foreach ( range( 2, min( intval( $auth_multisite_settings['cas_num_servers'] ), 10 ) ) as $cas_num_server ) {
1195 - if ( ! array_key_exists( 'cas_custom_label_' . $cas_num_server, $auth_multisite_settings ) ) {
1196 - $auth_multisite_settings[ 'cas_custom_label_' . $cas_num_server ] = 'CAS';
1197 - }
1198 - if ( ! array_key_exists( 'cas_host_' . $cas_num_server, $auth_multisite_settings ) ) {
1199 - $auth_multisite_settings[ 'cas_host_' . $cas_num_server ] = '';
1200 - }
1201 - if ( ! array_key_exists( 'cas_port_' . $cas_num_server, $auth_multisite_settings ) ) {
1202 - $auth_multisite_settings[ 'cas_port_' . $cas_num_server ] = '';
1203 - }
1204 - if ( ! array_key_exists( 'cas_path_' . $cas_num_server, $auth_multisite_settings ) ) {
1205 - $auth_multisite_settings[ 'cas_path_' . $cas_num_server ] = '';
1206 - }
1207 - if ( ! array_key_exists( 'cas_method_' . $cas_num_server, $auth_multisite_settings ) ) {
1208 - $auth_multisite_settings[ 'cas_method_' . $cas_num_server ] = Options\External\Cas::get_instance()->sanitize_cas_method();
1209 - }
1210 - if ( ! array_key_exists( 'cas_version_' . $cas_num_server, $auth_multisite_settings ) ) {
1211 - $auth_multisite_settings[ 'cas_version_' . $cas_num_server ] = Options\External\Cas::get_instance()->sanitize_cas_version();
1212 - }
1213 - if ( ! array_key_exists( 'cas_attr_email_' . $cas_num_server, $auth_multisite_settings ) ) {
1214 - $auth_multisite_settings[ 'cas_attr_email_' . $cas_num_server ] = '';
1215 - }
1216 - if ( ! array_key_exists( 'cas_attr_first_name_' . $cas_num_server, $auth_multisite_settings ) ) {
1217 - $auth_multisite_settings[ 'cas_attr_first_name_' . $cas_num_server ] = '';
1218 - }
1219 - if ( ! array_key_exists( 'cas_attr_last_name_' . $cas_num_server, $auth_multisite_settings ) ) {
1220 - $auth_multisite_settings[ 'cas_attr_last_name_' . $cas_num_server ] = '';
1221 - }
1222 - if ( ! array_key_exists( 'cas_attr_update_on_login_' . $cas_num_server, $auth_multisite_settings ) ) {
1223 - $auth_multisite_settings[ 'cas_attr_update_on_login_' . $cas_num_server ] = '';
1224 - }
1225 - if ( ! array_key_exists( 'cas_link_on_username_' . $cas_num_server, $auth_multisite_settings ) ) {
1226 - $auth_multisite_settings[ 'cas_link_on_username_' . $cas_num_server ] = '';
1227 - }
1228 - }
1229 - }
1230 - if ( ! array_key_exists( 'ldap', $auth_multisite_settings ) ) {
1231 - $auth_multisite_settings['ldap'] = '';
1232 - }
1233 659 if ( ! array_key_exists( 'ldap_host', $auth_multisite_settings ) ) {
1234 660 $auth_multisite_settings['ldap_host'] = '';
1235 661 }
1236 662 if ( ! array_key_exists( 'ldap_port', $auth_multisite_settings ) ) {
@@ -1287,11 +713,8 @@
1287 713 }
1288 714 if ( ! array_key_exists( 'advanced_disable_wp_login', $auth_multisite_settings ) ) {
1289 715 $auth_multisite_settings['advanced_disable_wp_login'] = '';
1290 716 }
1291 - if ( ! array_key_exists( 'advanced_disable_wp_login_bypass_usernames', $auth_multisite_settings ) ) {
1292 - $auth_multisite_settings['advanced_disable_wp_login_bypass_usernames'] = '';
1293 - }
1294 717 if ( ! array_key_exists( 'advanced_users_per_page', $auth_multisite_settings ) ) {
1295 718 $auth_multisite_settings['advanced_users_per_page'] = 20;
1296 719 }
1297 720 if ( ! array_key_exists( 'advanced_users_sort_by', $auth_multisite_settings ) ) {
@@ -1299,11 +722,8 @@
1299 722 }
1300 723 if ( ! array_key_exists( 'advanced_users_sort_order', $auth_multisite_settings ) ) {
1301 724 $auth_multisite_settings['advanced_users_sort_order'] = 'asc';
1302 725 }
1303 - if ( ! array_key_exists( 'advanced_show_usernames', $auth_multisite_settings ) ) {
1304 - $auth_multisite_settings['advanced_show_usernames'] = '';
1305 - }
1306 726 if ( ! array_key_exists( 'advanced_widget_enabled', $auth_multisite_settings ) ) {
1307 727 $auth_multisite_settings['advanced_widget_enabled'] = '1';
1308 728 }
1309 729 // Save default network options to database.
@@ -1352,16 +772,8 @@
1352 772 if ( ! in_array( $auth_settings['access_who_can_view'], array( 'everyone', 'logged_in_users' ), true ) ) {
1353 773 $auth_settings['access_who_can_view'] = 'everyone';
1354 774 }
1355 775
1356 - // Make sure users receiving pending user notifications is an empty array if
1357 - // it's empty.
1358 - // Note: this option doesn't exist in multisite options, so we first
1359 - // check to see if it exists.
1360 - if ( array_key_exists( 'access_users_receive_pending_emails', $auth_settings ) && ! is_array( $auth_settings['access_users_receive_pending_emails'] ) ) {
1361 - $auth_settings['access_users_receive_pending_emails'] = array();
1362 - }
1363 -
1364 776 // Default to WordPress login access redirect.
1365 777 // Note: this option doesn't exist in multisite options, so we first
1366 778 // check to see if it exists.
1367 779 if ( array_key_exists( 'access_redirect', $auth_settings ) && ! in_array( $auth_settings['access_redirect'], array( 'login', 'page', 'message' ), true ) ) {
@@ -1380,38 +792,11 @@
1380 792
1381 793 // Sanitize Enable OAuth2 Logins (checkbox: value can only be '1' or empty string).
1382 794 $auth_settings['oauth2'] = array_key_exists( 'oauth2', $auth_settings ) && strlen( $auth_settings['oauth2'] ) > 0 ? '1' : '';
1383 795
1384 - // Sanitize OAuth2 auto-login (select: value can be between '1' and '20' or empty string).
1385 - if ( ! isset( $auth_settings['oauth2_auto_login'] ) || ! in_array( $auth_settings['oauth2_auto_login'], array( '', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20' ), true ) ) {
1386 - $auth_settings['oauth2_auto_login'] = '';
1387 - }
796 + // Sanitize OAuth2 auto-login (checkbox: value can only be '1' or empty string).
797 + $auth_settings['oauth2_auto_login'] = array_key_exists( 'oauth2_auto_login', $auth_settings ) && strlen( $auth_settings['oauth2_auto_login'] ) > 0 ? '1' : '';
1388 798
1389 - // Sanitize OAuth2 number of servers (range: value can only be '1' to '20').
1390 - $auth_settings['oauth2_num_servers'] = filter_var( $auth_settings['oauth2_num_servers'], FILTER_SANITIZE_NUMBER_INT );
1391 - $auth_settings['oauth2_num_servers'] = intval( $auth_settings['oauth2_num_servers'] ) < 1 || intval( $auth_settings['oauth2_num_servers'] ) > 20 ? '1' : $auth_settings['oauth2_num_servers'];
1392 -
1393 - // Sanitize Oauth2 attribute update (select: value can only be 'update-if-empty', '1', or empty string).
1394 - if ( ! isset( $auth_settings['oauth2_attr_update_on_login'] ) || ! in_array( $auth_settings['oauth2_attr_update_on_login'], array( '', '1', 'update-if-empty' ), true ) ) {
1395 - $auth_settings['oauth2_attr_update_on_login'] = '';
1396 - }
1397 -
1398 - // Sanitize OAuth2 link on username (checkbox: value can only be '1' or empty string).
1399 - $auth_settings['oauth2_link_on_username'] = array_key_exists( 'oauth2_link_on_username', $auth_settings ) && strlen( $auth_settings['oauth2_link_on_username'] ) > 0 ? '1' : '';
1400 -
1401 - // Sanitize settings for any additional OAuth2 servers.
1402 - if ( intval( $auth_settings['oauth2_num_servers'] ) > 1 ) {
1403 - foreach ( range( 2, min( intval( $auth_settings['oauth2_num_servers'] ), 20 ) ) as $oauth2_num_server ) {
1404 - // Sanitize Oauth2 attribute update (select: value can only be 'update-if-empty', '1', or empty string).
1405 - if ( ! isset( $auth_settings[ 'oauth2_attr_update_on_login_' . $oauth2_num_server ] ) || ! in_array( $auth_settings[ 'oauth2_attr_update_on_login_' . $oauth2_num_server ], array( '', '1', 'update-if-empty' ), true ) ) {
1406 - $auth_settings[ 'oauth2_attr_update_on_login_' . $oauth2_num_server ] = '';
1407 - }
1408 -
1409 - // Sanitize OAuth2 link on username (checkbox: value can only be '1' or empty string).
1410 - $auth_settings[ 'oauth2_link_on_username_' . $oauth2_num_server ] = array_key_exists( 'oauth2_link_on_username_' . $oauth2_num_server, $auth_settings ) && strlen( $auth_settings[ 'oauth2_link_on_username_' . $oauth2_num_server ] ) > 0 ? '1' : '';
1411 - }
1412 - }
1413 -
1414 799 // Sanitize Enable Google Logins (checkbox: value can only be '1' or empty string).
1415 800 $auth_settings['google'] = array_key_exists( 'google', $auth_settings ) && strlen( $auth_settings['google'] ) > 0 ? '1' : '';
1416 801
1417 802 // Sanitize Enable CAS Logins (checkbox: value can only be '1' or empty string).
@@ -1416,17 +801,11 @@
1416 801
1417 802 // Sanitize Enable CAS Logins (checkbox: value can only be '1' or empty string).
1418 803 $auth_settings['cas'] = array_key_exists( 'cas', $auth_settings ) && strlen( $auth_settings['cas'] ) > 0 ? '1' : '';
1419 804
1420 - // Sanitize CAS auto-login (select: value can be between '1' and '10' or empty string).
1421 - if ( ! isset( $auth_settings['cas_auto_login'] ) || ! in_array( $auth_settings['cas_auto_login'], array( '', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ), true ) ) {
1422 - $auth_settings['cas_auto_login'] = '';
1423 - }
805 + // Sanitize CAS auto-login (checkbox: value can only be '1' or empty string).
806 + $auth_settings['cas_auto_login'] = array_key_exists( 'cas_auto_login', $auth_settings ) && strlen( $auth_settings['cas_auto_login'] ) > 0 ? '1' : '';
1424 807
1425 - // Sanitize CAS number of servers (range: value can only be '1' to '10').
1426 - $auth_settings['cas_num_servers'] = filter_var( $auth_settings['cas_num_servers'], FILTER_SANITIZE_NUMBER_INT );
1427 - $auth_settings['cas_num_servers'] = intval( $auth_settings['cas_num_servers'] ) < 1 || intval( $auth_settings['cas_num_servers'] ) > 10 ? '1' : $auth_settings['cas_num_servers'];
1428 -
1429 808 // Sanitize CAS Host setting.
1430 809 $auth_settings['cas_host'] = filter_var( $auth_settings['cas_host'], FILTER_SANITIZE_URL );
1431 810
1432 811 // Sanitize CAS Port (int).
@@ -1439,27 +818,8 @@
1439 818
1440 819 // Sanitize CAS link on username (checkbox: value can only be '1' or empty string).
1441 820 $auth_settings['cas_link_on_username'] = array_key_exists( 'cas_link_on_username', $auth_settings ) && strlen( $auth_settings['cas_link_on_username'] ) > 0 ? '1' : '';
1442 821
1443 - // Sanitize settings for any additional CAS servers.
1444 - if ( intval( $auth_settings['cas_num_servers'] ) > 1 ) {
1445 - foreach ( range( 2, min( intval( $auth_settings['cas_num_servers'] ), 10 ) ) as $cas_num_server ) {
1446 - // Sanitize CAS Host setting.
1447 - $auth_settings[ 'cas_host_' . $cas_num_server ] = filter_var( $auth_settings[ 'cas_host_' . $cas_num_server ] ?? '', FILTER_SANITIZE_URL );
1448 -
1449 - // Sanitize CAS Port (int).
1450 - $auth_settings[ 'cas_port_' . $cas_num_server ] = filter_var( $auth_settings[ 'cas_port_' . $cas_num_server ] ?? '', FILTER_SANITIZE_NUMBER_INT );
1451 -
1452 - // Sanitize CAS attribute update (select: value can only be 'update-if-empty', '1', or empty string).
1453 - if ( ! isset( $auth_settings[ 'cas_attr_update_on_login_' . $cas_num_server ] ) || ! in_array( $auth_settings[ 'cas_attr_update_on_login_' . $cas_num_server ], array( '', '1', 'update-if-empty' ), true ) ) {
1454 - $auth_settings[ 'cas_attr_update_on_login_' . $cas_num_server ] = '';
1455 - }
1456 -
1457 - // Sanitize CAS link on username (checkbox: value can only be '1' or empty string).
1458 - $auth_settings[ 'cas_link_on_username_' . $cas_num_server ] = array_key_exists( 'cas_link_on_username_' . $cas_num_server, $auth_settings ) && strlen( $auth_settings[ 'cas_link_on_username_' . $cas_num_server ] ) > 0 ? '1' : '';
1459 - }
1460 - }
1461 -
1462 822 // Sanitize Enable LDAP Logins (checkbox: value can only be '1' or empty string).
1463 823 $auth_settings['ldap'] = array_key_exists( 'ldap', $auth_settings ) && strlen( $auth_settings['ldap'] ) > 0 ? '1' : '';
1464 824
1465 825 // Sanitize LDAP Port (int).
@@ -1484,63 +844,8 @@
1484 844 if ( ! isset( $auth_settings['ldap_attr_update_on_login'] ) || ! in_array( $auth_settings['ldap_attr_update_on_login'], array( '', '1', 'update-if-empty' ), true ) ) {
1485 845 $auth_settings['ldap_attr_update_on_login'] = '';
1486 846 }
1487 847
1488 - // Sanitize Enable OIDC Logins (checkbox: value can only be '1' or empty string).
1489 - $auth_settings['oidc'] = array_key_exists( 'oidc', $auth_settings ) && strlen( $auth_settings['oidc'] ) > 0 ? '1' : '';
1490 -
1491 - // Sanitize OIDC Num Servers (int, 1-20).
1492 - $auth_settings['oidc_num_servers'] = filter_var( $auth_settings['oidc_num_servers'] ?? '1', FILTER_SANITIZE_NUMBER_INT );
1493 - $auth_settings['oidc_num_servers'] = intval( $auth_settings['oidc_num_servers'] ) < 1 || intval( $auth_settings['oidc_num_servers'] ) > 20 ? '1' : $auth_settings['oidc_num_servers'];
1494 -
1495 - // Sanitize OIDC auto-login (select: value can be between '1' and '20' or empty string).
1496 - if ( ! isset( $auth_settings['oidc_auto_login'] ) || ! in_array( $auth_settings['oidc_auto_login'], array( '', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20' ), true ) ) {
1497 - $auth_settings['oidc_auto_login'] = '';
1498 - }
1499 -
1500 - // Sanitize OIDC Issuer URL.
1501 - $auth_settings['oidc_issuer'] = filter_var( $auth_settings['oidc_issuer'] ?? '', FILTER_SANITIZE_URL );
1502 -
1503 - // Sanitize OIDC attribute update (select: value can only be 'update-if-empty', '1', or empty string).
1504 - if ( ! isset( $auth_settings['oidc_attr_update_on_login'] ) || ! in_array( $auth_settings['oidc_attr_update_on_login'], array( '', '1', 'update-if-empty' ), true ) ) {
1505 - $auth_settings['oidc_attr_update_on_login'] = '';
1506 - }
1507 -
1508 - // Sanitize OIDC force auth method (select: value can only be 'client_secret_basic', 'client_secret_post', 'client_secret_jwt', 'private_key_jwt', or empty string).
1509 - if ( ! isset( $auth_settings['oidc_force_auth_method'] ) || ! in_array( $auth_settings['oidc_force_auth_method'], array( '', 'client_secret_basic', 'client_secret_post', 'client_secret_jwt', 'private_key_jwt' ), true ) ) {
1510 - $auth_settings['oidc_force_auth_method'] = '';
1511 - }
1512 -
1513 - // Sanitize OIDC require verified email (checkbox: value can only be '1' or empty string).
1514 - $auth_settings['oidc_require_verified_email'] = array_key_exists( 'oidc_require_verified_email', $auth_settings ) && strlen( $auth_settings['oidc_require_verified_email'] ) > 0 ? '1' : '';
1515 -
1516 - // Sanitize OIDC link on username (checkbox: value can only be '1' or empty string).
1517 - $auth_settings['oidc_link_on_username'] = array_key_exists( 'oidc_link_on_username', $auth_settings ) && strlen( $auth_settings['oidc_link_on_username'] ) > 0 ? '1' : '';
1518 -
1519 - // Sanitize settings for any additional OIDC servers.
1520 - if ( intval( $auth_settings['oidc_num_servers'] ) > 1 ) {
1521 - foreach ( range( 2, min( intval( $auth_settings['oidc_num_servers'] ), 20 ) ) as $oidc_num_server ) {
1522 - // Sanitize OIDC Issuer URL.
1523 - $auth_settings[ 'oidc_issuer_' . $oidc_num_server ] = filter_var( $auth_settings[ 'oidc_issuer_' . $oidc_num_server ] ?? '', FILTER_SANITIZE_URL );
1524 -
1525 - // Sanitize OIDC attribute update (select: value can only be 'update-if-empty', '1', or empty string).
1526 - if ( ! isset( $auth_settings[ 'oidc_attr_update_on_login_' . $oidc_num_server ] ) || ! in_array( $auth_settings[ 'oidc_attr_update_on_login_' . $oidc_num_server ], array( '', '1', 'update-if-empty' ), true ) ) {
1527 - $auth_settings[ 'oidc_attr_update_on_login_' . $oidc_num_server ] = '';
1528 - }
1529 -
1530 - // Sanitize OIDC force auth method (select: value can only be 'client_secret_basic', 'client_secret_post', 'client_secret_jwt', 'private_key_jwt', or empty string).
1531 - if ( ! isset( $auth_settings[ 'oidc_force_auth_method' . $oidc_num_server ] ) || ! in_array( $auth_settings[ 'oidc_force_auth_method' . $oidc_num_server ], array( '', 'client_secret_basic', 'client_secret_post', 'client_secret_jwt', 'private_key_jwt' ), true ) ) {
1532 - $auth_settings[ 'oidc_force_auth_method' . $oidc_num_server ] = '';
1533 - }
1534 -
1535 - // Sanitize OIDC require verified email (checkbox: value can only be '1' or empty string).
1536 - $auth_settings[ 'oidc_require_verified_email_' . $oidc_num_server ] = array_key_exists( 'oidc_require_verified_email_' . $oidc_num_server, $auth_settings ) && strlen( $auth_settings[ 'oidc_require_verified_email_' . $oidc_num_server ] ) > 0 ? '1' : '';
1537 -
1538 - // Sanitize OIDC link on username (checkbox: value can only be '1' or empty string).
1539 - $auth_settings[ 'oidc_link_on_username_' . $oidc_num_server ] = array_key_exists( 'oidc_link_on_username_' . $oidc_num_server, $auth_settings ) && strlen( $auth_settings[ 'oidc_link_on_username_' . $oidc_num_server ] ) > 0 ? '1' : '';
1540 - }
1541 - }
1542 -
1543 848 // Make sure public pages is an empty array if it's empty.
1544 849 // Note: this option doesn't exist in multisite options, so we first
1545 850 // check to see if it exists.
1546 851 if ( array_key_exists( 'access_public_pages', $auth_settings ) && ! is_array( $auth_settings['access_public_pages'] ) ) {
@@ -1574,11 +879,8 @@
1574 879 if ( ! isset( $auth_settings['advanced_users_sort_order'] ) || ! in_array( $auth_settings['advanced_users_sort_order'], array( 'asc', 'desc' ), true ) ) {
1575 880 $auth_settings['advanced_users_sort_order'] = 'asc';
1576 881 }
1577 882
1578 - // Sanitize Show usernames in approved users list (checkbox: value can only be '1' or empty string).
1579 - $auth_settings['advanced_show_usernames'] = array_key_exists( 'advanced_show_usernames', $auth_settings ) && strlen( $auth_settings['advanced_show_usernames'] ) > 0 ? '1' : '';
1580 -
1581 883 // Sanitize Show Dashboard Widget (checkbox: value can only be '1' or empty string).
1582 884 $auth_settings['advanced_widget_enabled'] = array_key_exists( 'advanced_widget_enabled', $auth_settings ) && strlen( $auth_settings['advanced_widget_enabled'] ) > 0 ? '1' : '';
1583 885
1584 886 // Sanitize Override multisite options (checkbox: value can only be '1' or empty string).
@@ -1657,9 +959,9 @@
1657 959
1658 960 /**
1659 961 * Settings print callback.
1660 962 *
1661 - * @param array $args Args (e.g., multisite admin mode).
963 + * @param string $args Args (e.g., multisite admin mode).
1662 964 * @return void
1663 965 */
1664 966 public function print_section_info_tabs( $args = '' ) {
1665 967 if ( Helper::NETWORK_CONTEXT === Helper::get_context( $args ) ) :
@@ -1666,13 +968,8 @@
1666 968 ?>
1667 969 <h2 class="nav-tab-wrapper">
1668 970 <a class="nav-tab nav-tab-access_lists nav-tab-active" href="javascript:chooseTab('access_lists' );"><?php esc_html_e( 'Access Lists', 'authorizer' ); ?></a>
1669 971 <a class="nav-tab nav-tab-external" href="javascript:chooseTab('external' );"><?php esc_html_e( 'External Service', 'authorizer' ); ?></a>
1670 - <a class="nav-tab nav-tab-external_oauth2" href="javascript:chooseTab('external_oauth2' );"><?php esc_html_e( 'OAuth2', 'authorizer' ); ?></a>
1671 - <a class="nav-tab nav-tab-external_oidc" href="javascript:chooseTab('external_oidc' );"><?php esc_html_e( 'OIDC', 'authorizer' ); ?></a>
1672 - <a class="nav-tab nav-tab-external_google" href="javascript:chooseTab('external_google' );"><?php esc_html_e( 'Google', 'authorizer' ); ?></a>
1673 - <a class="nav-tab nav-tab-external_cas" href="javascript:chooseTab('external_cas' );"><?php esc_html_e( 'CAS', 'authorizer' ); ?></a>
1674 - <a class="nav-tab nav-tab-external_ldap" href="javascript:chooseTab('external_ldap' );"><?php esc_html_e( 'LDAP', 'authorizer' ); ?></a>
1675 972 <a class="nav-tab nav-tab-advanced" href="javascript:chooseTab('advanced' );"><?php esc_html_e( 'Advanced', 'authorizer' ); ?></a>
1676 973 </h2>
1677 974 <?php else : ?>
1678 975 <h2 class="nav-tab-wrapper">
@@ -1679,13 +976,8 @@
1679 976 <a class="nav-tab nav-tab-access_lists nav-tab-active" href="javascript:chooseTab('access_lists' );"><?php esc_html_e( 'Access Lists', 'authorizer' ); ?></a>
1680 977 <a class="nav-tab nav-tab-access_login" href="javascript:chooseTab('access_login' );"><?php esc_html_e( 'Login Access', 'authorizer' ); ?></a>
1681 978 <a class="nav-tab nav-tab-access_public" href="javascript:chooseTab('access_public' );"><?php esc_html_e( 'Public Access', 'authorizer' ); ?></a>
1682 979 <a class="nav-tab nav-tab-external" href="javascript:chooseTab('external' );"><?php esc_html_e( 'External Service', 'authorizer' ); ?></a>
1683 - <a class="nav-tab nav-tab-external_oauth2" href="javascript:chooseTab('external_oauth2' );"><?php esc_html_e( 'OAuth2', 'authorizer' ); ?></a>
1684 - <a class="nav-tab nav-tab-external_oidc" href="javascript:chooseTab('external_oidc' );"><?php esc_html_e( 'OIDC', 'authorizer' ); ?></a>
1685 - <a class="nav-tab nav-tab-external_google" href="javascript:chooseTab('external_google' );"><?php esc_html_e( 'Google', 'authorizer' ); ?></a>
1686 - <a class="nav-tab nav-tab-external_cas" href="javascript:chooseTab('external_cas' );"><?php esc_html_e( 'CAS', 'authorizer' ); ?></a>
1687 - <a class="nav-tab nav-tab-external_ldap" href="javascript:chooseTab('external_ldap' );"><?php esc_html_e( 'LDAP', 'authorizer' ); ?></a>
1688 980 <a class="nav-tab nav-tab-advanced" href="javascript:chooseTab('advanced' );"><?php esc_html_e( 'Advanced', 'authorizer' ); ?></a>
1689 981 </h2>
1690 982 <?php
1691 983 endif;