PluginProbe
Authorizer / 3.9.0
Authorizer v3.9.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 2.9.6 All 126 releases
← All changes | src/authorizer/class-admin-page.php +220 -33 2.9.133.9.0 View file →
@@ -14,8 +14,9 @@
14 14 use Authorizer\Options\Access_Lists;
15 15 use Authorizer\Options\Login_Access;
16 16 use Authorizer\Options\Public_Access;
17 17 use Authorizer\Options\External;
18 +use Authorizer\Options\External\OAuth2;
18 19 use Authorizer\Options\External\Google;
19 20 use Authorizer\Options\External\Cas;
20 21 use Authorizer\Options\External\Ldap;
21 22 use Authorizer\Options\Advanced;
@@ -23,9 +24,9 @@
23 24 /**
24 25 * Contains functions for creating the Authorizer Settings page and adding it to
25 26 * the WordPress Dashboard menu.
26 27 */
27 -class Admin_Page extends Static_Instance {
28 +class Admin_Page extends Singleton {
28 29
29 30 /**
30 31 * Add help documentation to the options page.
31 32 *
@@ -33,8 +34,13 @@
33 34 */
34 35 public function admin_head() {
35 36 $screen = get_current_screen();
36 37
38 + // Don't print any help items if not on the Authorizer Settings page.
39 + if ( empty( $screen->id ) || ! in_array( $screen->id, array( 'toplevel_page_authorizer-network', 'toplevel_page_authorizer', 'settings_page_authorizer' ), true ) ) {
40 + return;
41 + }
42 +
37 43 // Add help tab for Access Lists Settings.
38 44 $help_auth_settings_access_lists_content = '
39 45 <p>' . __( "<strong>Pending Users</strong>: Pending users are users who have successfully logged in to the site, but who haven't yet been approved (or blocked) by you.", 'authorizer' ) . '</p>
40 46 <p>' . __( '<strong>Approved Users</strong>: Approved users have access to the site once they successfully log in.', 'authorizer' ) . '</p>
@@ -44,9 +50,9 @@
44 50 $screen->add_help_tab(
45 51 array(
46 52 'id' => 'help_auth_settings_access_lists_content',
47 53 'title' => __( 'Access Lists', 'authorizer' ),
48 - 'content' => $help_auth_settings_access_lists_content,
54 + 'content' => wp_kses_post( $help_auth_settings_access_lists_content ),
49 55 )
50 56 );
51 57
52 58 // Add help tab for Login Access Settings.
@@ -58,9 +64,9 @@
58 64 $screen->add_help_tab(
59 65 array(
60 66 'id' => 'help_auth_settings_access_login_content',
61 67 'title' => __( 'Login Access', 'authorizer' ),
62 - 'content' => $help_auth_settings_access_login_content,
68 + 'content' => wp_kses_post( $help_auth_settings_access_login_content ),
63 69 )
64 70 );
65 71
66 72 // Add help tab for Public Access Settings.
@@ -74,9 +80,9 @@
74 80 $screen->add_help_tab(
75 81 array(
76 82 'id' => 'help_auth_settings_access_public_content',
77 83 'title' => __( 'Public Access', 'authorizer' ),
78 - 'content' => $help_auth_settings_access_public_content,
84 + 'content' => wp_kses_post( $help_auth_settings_access_public_content ),
79 85 )
80 86 );
81 87
82 88 // Add help tab for External Service (CAS, LDAP) Settings.
@@ -81,16 +87,25 @@
81 87
82 88 // Add help tab for External Service (CAS, LDAP) Settings.
83 89 $help_auth_settings_external_content = '
84 90 <p>' . __( "<strong>Type of external service to authenticate against</strong>: Choose which authentication service type you will be using. You'll have to fill out different fields below depending on which service you choose.", 'authorizer' ) . '</p>
91 + <p>' . __( '<strong>Enable OAuth2 Logins</strong>: Choose if you want to allow users to log in with one of the supported OAuth2 providers. You will need to enter your API Client ID and Secret to enable these logins.', 'authorizer' ) . '</p>
85 92 <p>' . __( '<strong>Enable Google Logins</strong>: Choose if you want to allow users to log in with their Google Account credentials. You will need to enter your API Client ID and Secret to enable Google Logins.', 'authorizer' ) . '</p>
86 93 <p>' . __( '<strong>Enable CAS Logins</strong>: Choose if you want to allow users to log in with via CAS (Central Authentication Service). You will need to enter details about your CAS server (host, port, and path) to enable CAS Logins.', 'authorizer' ) . '</p>
87 - <p>' . __( '<strong>Enable LDAP Logins</strong>: Choose if you want to allow users to log in with their LDAP (Lightweight Directory Access Protocol) credentials. You will need to enter details about your LDAP server (host, port, search base, uid attribute, directory user, directory user password, and whether to use TLS) to enable Google Logins.', 'authorizer' ) . '</p>
94 + <p>' . __( '<strong>Enable LDAP Logins</strong>: Choose if you want to allow users to log in with their LDAP (Lightweight Directory Access Protocol) credentials. You will need to enter details about your LDAP server (host, port, search base, uid attribute, directory user, directory user password, and whether to use STARTTLS) to enable LDAP Logins.', 'authorizer' ) . '</p>
88 95 <p>' . __( '<strong>Default role for new CAS users</strong>: Specify which role new external users will get by default. Be sure to choose a role with limited permissions!', 'authorizer' ) . '</p>
96 + <p><strong><em>' . __( 'If you enable OAuth2 logins:', 'authorizer' ) . '</em></strong></p>
97 + <ul>
98 + <li>' . __( '<strong>Client ID</strong>: You can generate this ID following the instructions for your specific provider.', 'authorizer' ) . '<br>' . __( "Note: for increased security, you can leave this field blank and instead define this value either in wp-config.php via <code>define( 'AUTHORIZER_OAUTH2_CLIENT_ID', '...' );</code>, or you may fetch it from an external service like AWS Secrets Manager by hooking into the <code>authorizer_oauth2_client_id</code> filter. This will prevent it from being stored in plaintext in the WordPress database.", 'authorizer' ) . '</li>
99 + <li>' . __( '<strong>Client Secret</strong>: You can generate this secret by following the instructions for your specific provider.', 'authorizer' ) . '<br>' . __( "Note: for increased security, you can leave this field blank and instead define this value either in wp-config.php via <code>define( 'AUTHORIZER_OAUTH2_CLIENT_SECRET', '...' );</code>, or you may fetch it from an external service like AWS Secrets Manager by hooking into the <code>authorizer_oauth2_client_secret</code> filter. This will prevent it from being stored in plaintext in the WordPress database.", 'authorizer' ) . '</li>
100 + <li>' . __( '<strong>Authorization URL</strong>: For the generic OAuth2 provider, you will need to specify the 3 endpoints required for the oauth2 authentication flow. This is the first: the endpoint first contacted to initiate the authentication.', 'authorizer' ) . '</li>
101 + <li>' . __( '<strong>Access Token URL</strong>: For the generic OAuth2 provider, you will need to specify the 3 endpoints required for the oauth2 authentication flow. This is the second: the endpoint that is contacted after initiation to retrieve an access token for the user that just authenticated.', 'authorizer' ) . '</li>
102 + <li>' . __( '<strong>Resource Owner URL</strong>: For the generic OAuth2 provider, you will need to specify the 3 endpoints required for the oauth2 authentication flow. This is the third: the endpoint that is contacted after successfully receiving an authentication token to retrieve details on the user that just authenticated.', 'authorizer' ) . '</li>
103 + </ul>
89 104 <p><strong><em>' . __( 'If you enable Google logins:', 'authorizer' ) . '</em></strong></p>
90 105 <ul>
91 - <li>' . __( "<strong>Google Client ID</strong>: You can generate this ID by creating a new Project in the <a href='https://cloud.google.com/console'>Google Developers Console</a>. A Client ID typically looks something like this: 1234567890123-kdjr85yt6vjr6d8g7dhr8g7d6durjf7g.apps.googleusercontent.com", 'authorizer' ) . '</li>
92 - <li>' . __( "<strong>Google Client Secret</strong>: You can generate this secret by creating a new Project in the <a href='https://cloud.google.com/console'>Google Developers Console</a>. A Client Secret typically looks something like this: sDNgX5_pr_5bly-frKmvp8jT", 'authorizer' ) . '</li>
106 + <li>' . __( "<strong>Google Client ID</strong>: You can generate this ID by creating a new Project in the <a href='https://cloud.google.com/console'>Google Developers Console</a>. A Client ID typically looks something like this: 1234567890123-kdjr85yt6vjr6d8g7dhr8g7d6durjf7g.apps.googleusercontent.com", 'authorizer' ) . '<br>' . __( "Note: for increased security, you can leave this field blank and instead define this value either in wp-config.php via <code>define( 'AUTHORIZER_GOOGLE_CLIENT_ID', '...' );</code>, or you may fetch it from an external service like AWS Secrets Manager by hooking into the <code>authorizer_google_client_id</code> filter. This will prevent it from being stored in plaintext in the WordPress database.", 'authorizer' ) . '</li>
107 + <li>' . __( "<strong>Google Client Secret</strong>: You can generate this secret by creating a new Project in the <a href='https://cloud.google.com/console'>Google Developers Console</a>. A Client Secret typically looks something like this: sDNgX5_pr_5bly-frKmvp8jT", 'authorizer' ) . '<br>' . __( "Note: for increased security, you can leave this field blank and instead define this value either in wp-config.php via <code>define( 'AUTHORIZER_GOOGLE_CLIENT_SECRET', '...' );</code>, or you may fetch it from an external service like AWS Secrets Manager by hooking into the <code>authorizer_google_client_secret</code> filter. This will prevent it from being stored in plaintext in the WordPress database.", 'authorizer' ) . '</li>
93 108 </ul>
94 109 <p><strong><em>' . __( 'If you enable CAS logins:', 'authorizer' ) . '</em></strong></p>
95 110 <ul>
96 111 <li>' . __( '<strong>CAS server hostname</strong>: Enter the hostname of the CAS server you authenticate against (e.g., authn.example.edu).', 'authorizer' ) . '</li>
@@ -95,8 +110,9 @@
95 110 <ul>
96 111 <li>' . __( '<strong>CAS server hostname</strong>: Enter the hostname of the CAS server you authenticate against (e.g., authn.example.edu).', 'authorizer' ) . '</li>
97 112 <li>' . __( '<strong>CAS server port</strong>: Enter the port on the CAS server to connect to (e.g., 443).', 'authorizer' ) . '</li>
98 113 <li>' . __( '<strong>CAS server path/context</strong>: Enter the path to the login endpoint on the CAS server (e.g., /cas).', 'authorizer' ) . '</li>
114 + <li>' . __( '<strong>CAS server method</strong>: Select the method to use when setting the CAS config (e.g.,"client" or "proxy")', 'authorizer' ) . '</li>
99 115 <li>' . __( "<strong>CAS attribute containing first name</strong>: Enter the CAS attribute that has the user's first name. When this user first logs in, their WordPress account will have their first name retrieved from CAS and added to their WordPress profile.", 'authorizer' ) . '</li>
100 116 <li>' . __( "<strong>CAS attribute containing last name</strong>: Enter the CAS attribute that has the user's last name. When this user first logs in, their WordPress account will have their last name retrieved from CAS and added to their WordPress profile.", 'authorizer' ) . '</li>
101 117 <li>' . __( '<strong>CAS attribute update</strong>: Select whether the first and last names retrieved from CAS should overwrite any value the user has entered in the first and last name fields in their WordPress profile. If this is not set, this only happens the first time they log in.', 'authorizer' ) . '</li>
102 118 </ul>
@@ -104,12 +120,13 @@
104 120 <ul>
105 121 <li>' . __( '<strong>LDAP Host</strong>: Enter the URL of the LDAP server you authenticate against.', 'authorizer' ) . '</li>
106 122 <li>' . __( '<strong>LDAP Port</strong>: Enter the port number that the LDAP server listens on.', 'authorizer' ) . '</li>
107 123 <li>' . __( '<strong>LDAP Search Base</strong>: Enter the LDAP string that represents the search base, e.g., ou=people,dc=example,dc=edu', 'authorizer' ) . '</li>
124 + <li>' . __( '<strong>LDAP Search Filter</strong>: Enter the optional LDAP string that represents the search filter, e.g., (memberOf=cn=wp_users,ou=people,dc=example,dc=edu)', 'authorizer' ) . '</li>
108 125 <li>' . __( '<strong>LDAP attribute containing username</strong>: Enter the name of the LDAP attribute that contains the usernames used by those attempting to log in. The plugin will search on this attribute to find the cn to bind against for login attempts.', 'authorizer' ) . '</li>
109 - <li>' . __( '<strong>LDAP Directory User</strong>: Enter the name of the LDAP user that has permissions to browse the directory.', 'authorizer' ) . '</li>
110 - <li>' . __( '<strong>LDAP Directory User Password</strong>: Enter the password for the LDAP user that has permission to browse the directory.', 'authorizer' ) . '</li>
111 - <li>' . __( '<strong>Use TLS</strong>: Select whether all communication with the LDAP server should be performed over a TLS-secured connection.', 'authorizer' ) . '</li>
126 + <li>' . __( '<strong>LDAP Directory User</strong>: Enter the name of the LDAP user that has permissions to browse the directory.', 'authorizer' ) . '<br>' . __( "Note: for increased security, you can leave this field blank and instead define this value either in wp-config.php via <code>define( 'AUTHORIZER_LDAP_USER', '...' );</code>, or you may fetch it from an external service like AWS Secrets Manager by hooking into the <code>authorizer_ldap_user</code> filter. This will prevent it from being stored in plaintext in the WordPress database.", 'authorizer' ) . '</li>
127 + <li>' . __( '<strong>LDAP Directory User Password</strong>: Enter the password for the LDAP user that has permission to browse the directory.', 'authorizer' ) . '<br>' . __( "Note: for increased security, you can leave this field blank and instead define this value either in wp-config.php via <code>define( 'AUTHORIZER_LDAP_PASSWORD', '...' );</code>, or you may fetch it from an external service like AWS Secrets Manager by hooking into the <code>authorizer_ldap_password</code> filter. This will prevent it from being stored in the WordPress database.", 'authorizer' ) . '</li>
128 + <li>' . __( '<strong>Use STARTTLS</strong>: Select whether unencrypted communication with the LDAP server should be upgraded to a TLS-secured connection using STARTTLS.', 'authorizer' ) . '</li>
112 129 <li>' . __( "<strong>Custom lost password URL</strong>: The WordPress login page contains a link to recover a lost password. If you have external users who shouldn't change the password on their WordPress account, point them to the appropriate location to change the password on their external authentication service here.", 'authorizer' ) . '</li>
113 130 <li>' . __( "<strong>LDAP attribute containing first name</strong>: Enter the LDAP attribute that has the user's first name. When this user first logs in, their WordPress account will have their first name retrieved from LDAP and added to their WordPress profile.", 'authorizer' ) . '</li>
114 131 <li>' . __( "<strong>LDAP attribute containing last name</strong>: Enter the LDAP attribute that has the user's last name. When this user first logs in, their WordPress account will have their last name retrieved from LDAP and added to their WordPress profile.", 'authorizer' ) . '</li>
115 132 <li>' . __( '<strong>LDAP attribute update</strong>: Select whether the first and last names retrieved from LDAP should overwrite any value the user has entered in the first and last name fields in their WordPress profile. If this is not set, this only happens the first time they log in.', 'authorizer' ) . '</li>
@@ -118,9 +135,9 @@
118 135 $screen->add_help_tab(
119 136 array(
120 137 'id' => 'help_auth_settings_external_content',
121 138 'title' => __( 'External Service', 'authorizer' ),
122 - 'content' => $help_auth_settings_external_content,
139 + 'content' => wp_kses_post( $help_auth_settings_external_content ),
123 140 )
124 141 );
125 142
126 143 // Add help tab for Advanced Settings.
@@ -133,9 +150,9 @@
133 150 $screen->add_help_tab(
134 151 array(
135 152 'id' => 'help_auth_settings_advanced_content',
136 153 'title' => __( 'Advanced', 'authorizer' ),
137 - 'content' => $help_auth_settings_advanced_content,
154 + 'content' => wp_kses_post( $help_auth_settings_advanced_content ),
138 155 )
139 156 );
140 157 }
141 158
@@ -378,14 +395,99 @@
378 395 array( External::get_instance(), 'print_select_auth_access_default_role' ),
379 396 'authorizer',
380 397 'auth_settings_external'
381 398 );
399 +
382 400 add_settings_field(
401 + 'auth_settings_external_oauth2',
402 + __( 'OAuth2 Logins', 'authorizer' ),
403 + array( OAuth2::get_instance(), 'print_checkbox_auth_external_oauth2' ),
404 + 'authorizer',
405 + 'auth_settings_external',
406 + array(
407 + 'class' => 'border-top',
408 + )
409 + );
410 + add_settings_field(
411 + 'auth_settings_oauth2_provider',
412 + __( 'Provider', 'authorizer' ),
413 + array( OAuth2::get_instance(), 'print_select_oauth2_provider' ),
414 + 'authorizer',
415 + 'auth_settings_external'
416 + );
417 + add_settings_field(
418 + 'auth_settings_oauth2_custom_label',
419 + __( 'Custom label', 'authorizer' ),
420 + array( OAuth2::get_instance(), 'print_text_oauth2_custom_label' ),
421 + 'authorizer',
422 + 'auth_settings_external'
423 + );
424 + add_settings_field(
425 + 'auth_settings_oauth2_clientid',
426 + __( 'Client ID', 'authorizer' ),
427 + array( OAuth2::get_instance(), 'print_text_oauth2_clientid' ),
428 + 'authorizer',
429 + 'auth_settings_external'
430 + );
431 + add_settings_field(
432 + 'auth_settings_oauth2_clientsecret',
433 + __( 'Client Secret', 'authorizer' ),
434 + array( OAuth2::get_instance(), 'print_text_oauth2_clientsecret' ),
435 + 'authorizer',
436 + 'auth_settings_external'
437 + );
438 + add_settings_field(
439 + 'auth_settings_oauth2_hosteddomain',
440 + __( 'OAuth2 Hosted Domain', 'authorizer' ),
441 + array( OAuth2::get_instance(), 'print_text_oauth2_hosteddomain' ),
442 + 'authorizer',
443 + 'auth_settings_external'
444 + );
445 + add_settings_field(
446 + 'auth_settings_oauth2_tenant_id',
447 + __( 'Tenant ID', 'authorizer' ),
448 + array( OAuth2::get_instance(), 'print_text_oauth2_tenant_id' ),
449 + 'authorizer',
450 + 'auth_settings_external'
451 + );
452 + add_settings_field(
453 + 'auth_settings_oauth2_url_authorize',
454 + __( 'Authorization URL', 'authorizer' ),
455 + array( OAuth2::get_instance(), 'print_text_oauth2_url_authorize' ),
456 + 'authorizer',
457 + 'auth_settings_external'
458 + );
459 + add_settings_field(
460 + 'auth_settings_oauth2_url_token',
461 + __( 'Access Token URL', 'authorizer' ),
462 + array( OAuth2::get_instance(), 'print_text_oauth2_url_token' ),
463 + 'authorizer',
464 + 'auth_settings_external'
465 + );
466 + add_settings_field(
467 + 'auth_settings_oauth2_url_resource',
468 + __( 'Resource Owner URL', 'authorizer' ),
469 + array( OAuth2::get_instance(), 'print_text_oauth2_url_resource' ),
470 + 'authorizer',
471 + 'auth_settings_external'
472 + );
473 + add_settings_field(
474 + 'auth_settings_oauth2_auto_login',
475 + __( 'OAuth2 automatic login', 'authorizer' ),
476 + array( OAuth2::get_instance(), 'print_checkbox_oauth2_auto_login' ),
477 + 'authorizer',
478 + 'auth_settings_external'
479 + );
480 +
481 + add_settings_field(
383 482 'auth_settings_external_google',
384 483 __( 'Google Logins', 'authorizer' ),
385 484 array( Google::get_instance(), 'print_checkbox_auth_external_google' ),
386 485 'authorizer',
387 - 'auth_settings_external'
486 + 'auth_settings_external',
487 + array(
488 + 'class' => 'border-top',
489 + )
388 490 );
389 491 add_settings_field(
390 492 'auth_settings_google_clientid',
391 493 __( 'Google Client ID', 'authorizer' ),
@@ -406,14 +508,18 @@
406 508 array( Google::get_instance(), 'print_text_google_hosteddomain' ),
407 509 'authorizer',
408 510 'auth_settings_external'
409 511 );
512 +
410 513 add_settings_field(
411 514 'auth_settings_external_cas',
412 515 __( 'CAS Logins', 'authorizer' ),
413 516 array( Cas::get_instance(), 'print_checkbox_auth_external_cas' ),
414 517 'authorizer',
415 - 'auth_settings_external'
518 + 'auth_settings_external',
519 + array(
520 + 'class' => 'border-top',
521 + )
416 522 );
417 523 add_settings_field(
418 524 'auth_settings_cas_custom_label',
419 525 __( 'CAS custom label', 'authorizer' ),
@@ -442,10 +548,17 @@
442 548 'authorizer',
443 549 'auth_settings_external'
444 550 );
445 551 add_settings_field(
552 + 'auth_settings_cas_method',
553 + __( 'CAS server method', 'authorizer' ),
554 + array( Cas::get_instance(), 'print_select_cas_method' ),
555 + 'authorizer',
556 + 'auth_settings_external'
557 + );
558 + add_settings_field(
446 559 'auth_settings_cas_version',
447 - 'CAS server version',
560 + __( 'CAS server protocol', 'authorizer' ),
448 561 array( Cas::get_instance(), 'print_select_cas_version' ),
449 562 'authorizer',
450 563 'auth_settings_external'
451 564 );
@@ -472,9 +585,9 @@
472 585 );
473 586 add_settings_field(
474 587 'auth_settings_cas_attr_update_on_login',
475 588 __( 'CAS attribute update', 'authorizer' ),
476 - array( Cas::get_instance(), 'print_checkbox_cas_attr_update_on_login' ),
589 + array( Cas::get_instance(), 'print_select_cas_attr_update_on_login' ),
477 590 'authorizer',
478 591 'auth_settings_external'
479 592 );
480 593 add_settings_field(
@@ -495,9 +608,12 @@
495 608 'auth_settings_external_ldap',
496 609 __( 'LDAP Logins', 'authorizer' ),
497 610 array( Ldap::get_instance(), 'print_checkbox_auth_external_ldap' ),
498 611 'authorizer',
499 - 'auth_settings_external'
612 + 'auth_settings_external',
613 + array(
614 + 'class' => 'border-top',
615 + )
500 616 );
501 617 add_settings_field(
502 618 'auth_settings_ldap_host',
503 619 __( 'LDAP Host', 'authorizer' ),
@@ -513,9 +629,9 @@
513 629 'auth_settings_external'
514 630 );
515 631 add_settings_field(
516 632 'auth_settings_ldap_tls',
517 - __( 'Use TLS', 'authorizer' ),
633 + __( 'Use STARTTLS', 'authorizer' ),
518 634 array( Ldap::get_instance(), 'print_checkbox_ldap_tls' ),
519 635 'authorizer',
520 636 'auth_settings_external'
521 637 );
@@ -526,8 +642,15 @@
526 642 'authorizer',
527 643 'auth_settings_external'
528 644 );
529 645 add_settings_field(
646 + 'auth_settings_ldap_search_filter',
647 + __( 'LDAP Search Filter', 'authorizer' ),
648 + array( Ldap::get_instance(), 'print_text_ldap_search_filter' ),
649 + 'authorizer',
650 + 'auth_settings_external'
651 + );
652 + add_settings_field(
530 653 'auth_settings_ldap_uid',
531 654 __( 'LDAP attribute containing username', 'authorizer' ),
532 655 array( Ldap::get_instance(), 'print_text_ldap_uid' ),
533 656 'authorizer',
@@ -577,12 +700,19 @@
577 700 );
578 701 add_settings_field(
579 702 'auth_settings_ldap_attr_update_on_login',
580 703 __( 'LDAP attribute update', 'authorizer' ),
581 - array( Ldap::get_instance(), 'print_checkbox_ldap_attr_update_on_login' ),
704 + array( Ldap::get_instance(), 'print_select_ldap_attr_update_on_login' ),
582 705 'authorizer',
583 706 'auth_settings_external'
584 707 );
708 + add_settings_field(
709 + 'auth_settings_ldap_test_user',
710 + __( 'LDAP test connection', 'authorizer' ),
711 + array( Ldap::get_instance(), 'print_text_button_ldap_test_user' ),
712 + 'authorizer',
713 + 'auth_settings_external'
714 + );
585 715
586 716 // Create Advanced Settings section.
587 717 add_settings_section(
588 718 'auth_settings_advanced',
@@ -708,10 +838,11 @@
708 838 $external = External::get_instance();
709 839 $google = Google::get_instance();
710 840 $cas = Cas::get_instance();
711 841 $ldap = Ldap::get_instance();
842 + $oauth2 = OAuth2::get_instance();
712 843 $advanced = Advanced::get_instance();
713 - $auth_settings = get_blog_option( get_network()->blog_id, 'auth_multisite_settings', array() );
844 + $auth_settings = get_blog_option( get_main_site_id( get_main_network_id() ), 'auth_multisite_settings', array() );
714 845 ?>
715 846 <div class="wrap">
716 847 <form method="post" action="" autocomplete="off">
717 848 <h2><?php esc_html_e( 'Authorizer Settings', 'authorizer' ); ?></h2>
@@ -716,9 +847,10 @@
716 847 <form method="post" action="" autocomplete="off">
717 848 <h2><?php esc_html_e( 'Authorizer Settings', 'authorizer' ); ?></h2>
718 849 <p><?php echo wp_kses( __( 'Most <strong>Authorizer</strong> settings are set in the individual sites, but you can specify a few options here that apply to <strong>all sites in the network</strong>. These settings will override settings in the individual sites.', 'authorizer' ), Helper::$allowed_html ); ?></p>
719 850
720 - <input type="checkbox" id="auth_settings_multisite_override" name="auth_settings[multisite_override]" value="1"<?php checked( 1 === intval( $auth_settings['multisite_override'] ) ); ?> /><label for="auth_settings_multisite_override"><?php esc_html_e( 'Override individual site settings with the settings below', 'authorizer' ); ?></label>
851 + <p><input type="checkbox" id="auth_settings_multisite_override" name="auth_settings[multisite_override]" value="1"<?php checked( 1 === intval( $auth_settings['multisite_override'] ) ); ?> /><label for="auth_settings_multisite_override"><?php esc_html_e( 'Override individual site settings with the settings below', 'authorizer' ); ?></label></p>
852 + <p><input type="checkbox" id="auth_settings_prevent_override_multisite" name="auth_settings[prevent_override_multisite]" value="1"<?php checked( 1 === intval( $auth_settings['prevent_override_multisite'] ) ); ?> /><label for="auth_settings_prevent_override_multisite"><?php esc_html_e( 'Prevent site administrators from overriding any multisite settings defined here (via Authorizer > Advanced > Override multisite options)', 'authorizer' ); ?></label></p>
721 853
722 854 <div id="auth_multisite_settings_disabled_overlay" style="display: none;"></div>
723 855
724 856 <div class="wrap" id="auth_multisite_settings">
@@ -750,9 +882,53 @@
750 882 <tr>
751 883 <th scope="row"><?php esc_html_e( 'Default role for new users', 'authorizer' ); ?></th>
752 884 <td><?php $external->print_select_auth_access_default_role( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
753 885 </tr>
886 + <tr class="border-top">
887 + <th scope="row"><?php esc_html_e( 'OAuth2 Logins', 'authorizer' ); ?></th>
888 + <td><?php $oauth2->print_checkbox_auth_external_oauth2( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
889 + </tr>
754 890 <tr>
891 + <th scope="row"><?php esc_html_e( 'OAuth2 Provider', 'authorizer' ); ?></th>
892 + <td><?php $oauth2->print_select_oauth2_provider( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
893 + </tr>
894 + <tr>
895 + <th scope="row"><?php esc_html_e( 'Custom Label', 'authorizer' ); ?></th>
896 + <td><?php $oauth2->print_text_oauth2_custom_label( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
897 + </tr>
898 + <tr>
899 + <th scope="row"><?php esc_html_e( 'Client ID', 'authorizer' ); ?></th>
900 + <td><?php $oauth2->print_text_oauth2_clientid( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
901 + </tr>
902 + <tr>
903 + <th scope="row"><?php esc_html_e( 'Client Secret', 'authorizer' ); ?></th>
904 + <td><?php $oauth2->print_text_oauth2_clientsecret( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
905 + </tr>
906 + <tr>
907 + <th scope="row"><?php esc_html_e( 'OAuth2 Hosted Domain', 'authorizer' ); ?></th>
908 + <td><?php $oauth2->print_text_oauth2_hosteddomain( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
909 + </tr>
910 + <tr>
911 + <th scope="row"><?php esc_html_e( 'Tenant ID', 'authorizer' ); ?></th>
912 + <td><?php $oauth2->print_text_oauth2_tenant_id( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
913 + </tr>
914 + <tr>
915 + <th scope="row"><?php esc_html_e( 'Authorization URL', 'authorizer' ); ?></th>
916 + <td><?php $oauth2->print_text_oauth2_url_authorize( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
917 + </tr>
918 + <tr>
919 + <th scope="row"><?php esc_html_e( 'Access Token URL', 'authorizer' ); ?></th>
920 + <td><?php $oauth2->print_text_oauth2_url_token( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
921 + </tr>
922 + <tr>
923 + <th scope="row"><?php esc_html_e( 'Resource Owner URL', 'authorizer' ); ?></th>
924 + <td><?php $oauth2->print_text_oauth2_url_resource( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
925 + </tr>
926 + <tr>
927 + <th scope="row"><?php esc_html_e( 'OAuth2 automatic login', 'authorizer' ); ?></th>
928 + <td><?php $oauth2->print_checkbox_oauth2_auto_login( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
929 + </tr>
930 + <tr class="border-top">
755 931 <th scope="row"><?php esc_html_e( 'Google Logins', 'authorizer' ); ?></th>
756 932 <td><?php $google->print_checkbox_auth_external_google( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
757 933 </tr>
758 934 <tr>
@@ -766,9 +942,9 @@
766 942 <tr>
767 943 <th scope="row"><?php esc_html_e( 'Google Hosted Domain', 'authorizer' ); ?></th>
768 944 <td><?php $google->print_text_google_hosteddomain( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
769 945 </tr>
770 - <tr>
946 + <tr class="border-top">
771 947 <th scope="row"><?php esc_html_e( 'CAS Logins', 'authorizer' ); ?></th>
772 948 <td><?php $cas->print_checkbox_auth_external_cas( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
773 949 </tr>
774 950 <tr>
@@ -787,9 +963,13 @@
787 963 <th scope="row"><?php esc_html_e( 'CAS server path/context', 'authorizer' ); ?></th>
788 964 <td><?php $cas->print_text_cas_path( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
789 965 </tr>
790 966 <tr>
791 - <th scope="row"><?php esc_html_e( 'CAS server version', 'authorizer' ); ?></th>
967 + <th scope="row"><?php esc_html_e( 'CAS server method', 'authorizer' ); ?></th>
968 + <td><?php $cas->print_select_cas_method( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
969 + </tr>
970 + <tr>
971 + <th scope="row"><?php esc_html_e( 'CAS server protocol', 'authorizer' ); ?></th>
792 972 <td><?php $cas->print_select_cas_version( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
793 973 </tr>
794 974 <tr>
795 975 <th scope="row"><?php esc_html_e( 'CAS attribute containing email', 'authorizer' ); ?></th>
@@ -804,9 +984,9 @@
804 984 <td><?php $cas->print_text_cas_attr_last_name( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
805 985 </tr>
806 986 <tr>
807 987 <th scope="row"><?php esc_html_e( 'CAS attribute update', 'authorizer' ); ?></th>
808 - <td><?php $cas->print_checkbox_cas_attr_update_on_login( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
988 + <td><?php $cas->print_select_cas_attr_update_on_login( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
809 989 </tr>
810 990 <tr>
811 991 <th scope="row"><?php esc_html_e( 'CAS automatic login', 'authorizer' ); ?></th>
812 992 <td><?php $cas->print_checkbox_cas_auto_login( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
@@ -814,9 +994,9 @@
814 994 <tr>
815 995 <th scope="row"><?php esc_html_e( 'CAS users linked by username', 'authorizer' ); ?></th>
816 996 <td><?php $cas->print_checkbox_cas_link_on_username( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
817 997 </tr>
818 - <tr>
998 + <tr class="border-top">
819 999 <th scope="row"><?php esc_html_e( 'LDAP Logins', 'authorizer' ); ?></th>
820 1000 <td><?php $ldap->print_checkbox_auth_external_ldap( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
821 1001 </tr>
822 1002 <tr>
@@ -827,9 +1007,9 @@
827 1007 <th scope="row"><?php esc_html_e( 'LDAP Port', 'authorizer' ); ?></th>
828 1008 <td><?php $ldap->print_text_ldap_port( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
829 1009 </tr>
830 1010 <tr>
831 - <th scope="row"><?php esc_html_e( 'Use TLS', 'authorizer' ); ?></th>
1011 + <th scope="row"><?php esc_html_e( 'Use STARTTLS', 'authorizer' ); ?></th>
832 1012 <td><?php $ldap->print_checkbox_ldap_tls( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
833 1013 </tr>
834 1014 <tr>
835 1015 <th scope="row"><?php esc_html_e( 'LDAP Search Base', 'authorizer' ); ?></th>
@@ -835,8 +1015,12 @@
835 1015 <th scope="row"><?php esc_html_e( 'LDAP Search Base', 'authorizer' ); ?></th>
836 1016 <td><?php $ldap->print_text_ldap_search_base( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
837 1017 </tr>
838 1018 <tr>
1019 + <th scope="row"><?php esc_html_e( 'LDAP Search Filter', 'authorizer' ); ?></th>
1020 + <td><?php $ldap->print_text_ldap_search_filter( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
1021 + </tr>
1022 + <tr>
839 1023 <th scope="row"><?php esc_html_e( 'LDAP attribute containing username', 'authorizer' ); ?></th>
840 1024 <td><?php $ldap->print_text_ldap_uid( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
841 1025 </tr>
842 1026 <tr>
@@ -864,10 +1048,14 @@
864 1048 <td><?php $ldap->print_text_ldap_attr_last_name( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
865 1049 </tr>
866 1050 <tr>
867 1051 <th scope="row"><?php esc_html_e( 'LDAP attribute update', 'authorizer' ); ?></th>
868 - <td><?php $ldap->print_checkbox_ldap_attr_update_on_login( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
1052 + <td><?php $ldap->print_select_ldap_attr_update_on_login( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
869 1053 </tr>
1054 + <tr>
1055 + <th scope="row"><?php esc_html_e( 'LDAP test connection', 'authorizer' ); ?></th>
1056 + <td><?php $ldap->print_text_button_ldap_test_user( array( 'context' => Helper::NETWORK_CONTEXT ) ); ?></td>
1057 + </tr>
870 1058 </tbody></table>
871 1059
872 1060 <?php $advanced->print_section_info_advanced(); ?>
873 1061 <table class="form-table"><tbody>
@@ -970,9 +1158,9 @@
970 1158 * Action: load-toplevel_page_authorizer
971 1159 * Action: admin_head-index.php
972 1160 */
973 1161 public function load_options_page() {
974 - wp_enqueue_script( 'authorizer', plugins_url( 'js/authorizer.js', plugin_root() ), array( 'jquery-effects-shake' ), '2.9.12', true );
1162 + wp_enqueue_script( 'authorizer', plugins_url( 'js/authorizer.js', plugin_root() ), array( 'jquery-effects-shake' ), '3.8.4', true );
975 1163 wp_localize_script(
976 1164 'authorizer',
977 1165 'authL10n',
978 1166 array(
@@ -994,19 +1182,18 @@
994 1182 'is_network_admin' => is_network_admin() ? '1' : '0',
995 1183 )
996 1184 );
997 1185
998 - wp_enqueue_script( 'jquery-autogrow-textarea', plugins_url( 'vendor/jquery.autogrow-textarea/jquery.autogrow-textarea.js', plugin_root() ), array( 'jquery' ), '2.7.0', true );
1186 + wp_enqueue_script( 'jquery-autogrow-textarea', plugins_url( 'vendor-custom/jquery.autogrow-textarea/jquery.autogrow-textarea.js', plugin_root() ), array( 'jquery' ), '3.0.7', true );
999 1187
1000 - wp_enqueue_script( 'jquery.multi-select', plugins_url( 'vendor/jquery.multi-select/js/jquery.multi-select.js', plugin_root() ), array( 'jquery' ), '1.8', true );
1188 + wp_enqueue_script( 'jquery.multi-select', plugins_url( 'vendor-custom/jquery.multi-select/0.9.12/js/jquery.multi-select.js', plugin_root() ), array( 'jquery' ), '0.9.12', true );
1001 1189
1002 - wp_register_style( 'authorizer-css', plugins_url( 'css/authorizer.css', plugin_root() ), array(), '2.9.8' );
1190 + wp_register_style( 'authorizer-css', plugins_url( 'css/authorizer.css', plugin_root() ), array(), '3.8.4' );
1003 1191 wp_enqueue_style( 'authorizer-css' );
1004 1192
1005 - wp_register_style( 'jquery-multi-select-css', plugins_url( 'vendor/jquery.multi-select/css/multi-select.css', plugin_root() ), array(), '1.8' );
1193 + wp_register_style( 'jquery-multi-select-css', plugins_url( 'vendor-custom/jquery.multi-select/0.9.12/css/multi-select.css', plugin_root() ), array(), '0.9.12' );
1006 1194 wp_enqueue_style( 'jquery-multi-select-css' );
1007 1195
1008 1196 add_action( 'admin_notices', array( self::get_instance(), 'admin_notices' ) ); // Add any notices to the top of the options page.
1009 1197 add_action( 'admin_head', array( self::get_instance(), 'admin_head' ) ); // Add help documentation to the options page.
1010 1198 }
1011 -
1012 1199 }