Skip to content

Commit 9852db1

Browse files
authored
Merge pull request #292 from auth0/migrate-wt-ips
Migrate wt ips
2 parents 80f37ea + 846f96b commit 9852db1

File tree

5 files changed

+29
-14
lines changed

5 files changed

+29
-14
lines changed

WP_Auth0.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
/**
33
* Plugin Name: PLUGIN_NAME
44
* Description: PLUGIN_DESCRIPTION
5-
* Version: 3.2.15
5+
* Version: 3.2.16
66
* Author: Auth0
77
* Author URI: https://auth0.com
88
*/
99
define( 'WPA0_PLUGIN_FILE', __FILE__ );
1010
define( 'WPA0_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
1111
define( 'WPA0_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
1212
define( 'WPA0_LANG', 'wp-auth0' );
13-
define( 'AUTH0_DB_VERSION', 12 );
14-
define( 'WPA0_VERSION', '3.2.15' );
13+
define( 'AUTH0_DB_VERSION', 13 );
14+
define( 'WPA0_VERSION', '3.2.16' );
1515

1616
/**
1717
* Main plugin class

lib/WP_Auth0_DBManager.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,24 @@ public function install_db() {
114114

115115
if ( $this->current_db_version < 12 ) {
116116

117-
if ( strpos( $cdn_url, '10.' ) === false ) {
118-
$options->set('use_lock_10', false);
119-
} else {
120-
$options->set('use_lock_10', true);
121-
}
117+
if ( strpos( $cdn_url, '10.' ) === false ) {
118+
$options->set('use_lock_10', false);
119+
} else {
120+
$options->set('use_lock_10', true);
121+
}
122122

123-
}
123+
}
124+
125+
if ( $this->current_db_version < 13 ) {
126+
$ips = $options->get('migration_ips');
127+
$oldips = '138.91.154.99,54.221.228.15,54.183.64.135,54.67.77.38,54.67.15.170,54.183.204.205,54.173.21.107,54.85.173.28';
128+
129+
$ipCheck = new WP_Auth0_Ip_Check($options);
130+
131+
if ( $ips === $oldips ) {
132+
$options->set('migration_ips', $ipCheck->get_ip_by_region('us'));
133+
}
134+
}
124135

125136
$this->current_db_version = AUTH0_DB_VERSION;
126137
update_option( 'auth0_db_version', AUTH0_DB_VERSION );

lib/WP_Auth0_Ip_Check.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
class WP_Auth0_Ip_Check {
33

44
protected $valid_webtask_ips = array(
5-
'us' => '138.91.154.99,54.221.228.15,54.183.64.135,54.67.77.38,54.67.15.170,54.183.204.205,54.173.21.107,54.85.173.28',
5+
'us' => '138.91.154.99,54.183.64.135,54.67.77.38,54.67.15.170,54.183.204.205,54.173.21.107,54.85.173.28,35.167.74.121,35.160.3.103,35.166.202.113,52.14.40.253,52.14.38.78,52.14.17.114,52.71.209.77,34.195.142.251,52.200.94.42',
66
'eu' => '52.28.56.226,52.28.45.240,52.16.224.164,52.16.193.66',
77
'au' => '52.64.84.177,52.64.111.197',
88
);
@@ -26,6 +26,10 @@ public function get_ips_by_domain( $domain ) {
2626
return null;
2727
}
2828

29+
public function get_ip_by_region($region) {
30+
return $this->valid_webtask_ips[$region];
31+
}
32+
2933
protected function get_request_ip() {
3034
$valid_proxy_ip = $this->a0_options->get( 'valid_proxy_ip' );
3135

lib/WP_Auth0_Options.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function get_default($key) {
4545

4646
public function get_client_secret_as_key() {
4747
$secret = $this->get('client_secret', '');
48-
$isEncoded = $this->get('client_secret_b64_encoded', false);
48+
$isEncoded = $this->get('client_secret_b64_encoded', false);
4949
return $isEncoded ? JWT::urlsafeB64Decode($secret) : $secret;
5050
}
5151

@@ -58,7 +58,7 @@ protected function defaults() {
5858
'auto_login_method' => '',
5959
'client_id' => '',
6060
'client_secret' => '',
61-
'client_secret_b64_enabled' => true,
61+
'client_secret_b64_encoded' => true,
6262
'domain' => '',
6363
'form_title' => '',
6464
'icon_url' => '',

lib/admin/WP_Auth0_Admin_Basic.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function render_client_secret() {
7777
public function render_client_secret_b64_encoded() {
7878
$v = absint( $this->options->get( 'client_secret_b64_encoded' ) );
7979

80-
echo $this->render_a0_switch( "Not Base64 Enabled", "Base64 Enabled", 1, 1 == $v );
80+
echo $this->render_a0_switch( "wpa_client_secret_b64_encoded", "client_secret_b64_encoded", 1, 1 == $v );
8181
?>
8282
<div class="subelement">
8383
<span class="description"><?php echo __( 'Enable if your client secret is base64 enabled. If you are not sure, check your clients page in Auth0. Displayed below the client secret on that page is the text "The Client Secret is not base64 encoded.
@@ -165,7 +165,7 @@ public function render_basic_description() {
165165
}
166166

167167
public function basic_validation( $old_options, $input ) {
168-
168+
169169
// $input['registration_enabled'] = $old_options['registration_enabled'];
170170

171171
$input['client_id'] = sanitize_text_field( $input['client_id'] );

0 commit comments

Comments
 (0)