Skip to content

Commit cfdfbcc

Browse files
authored
Merge pull request #299 from auth0/dev
v3.2.19: add auth0_get_auto_login_connection filter
2 parents e87bb47 + 9cb2ab4 commit cfdfbcc

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,23 @@ If the filter returns null, it will lookup by email as stated in the [How doe it
8181
}
8282
```
8383

84+
### Customize autologin connection
85+
86+
This filter will allow to programatically set which connection the plugin should use when autologin is enabled.
87+
88+
```
89+
add_filter( 'auth0_get_auto_login_connection', 'auth0_get_auto_login_connection', 1, 1 );
90+
91+
function auth0_get_auto_login_connection($connection) {
92+
93+
if ( /* check some condition */ ) {
94+
return 'twitter';
95+
}
96+
97+
return $connection;
98+
}
99+
```
100+
84101
## API authentication
85102

86103
The last version of the plugin provides the ability integrate with **wp-jwt-auth** plugin to authenticate api calls via a HTTP Authorization Header.

WP_Auth0.php

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

1616
/**
1717
* Main plugin class
@@ -449,4 +449,4 @@ function get_auth0_curatedBlogName() {
449449
}
450450

451451
$a0_plugin = new WP_Auth0();
452-
$a0_plugin->init();
452+
$a0_plugin->init();

lib/WP_Auth0_LoginManager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,15 @@ public function login_auto() {
129129
}
130130
$state = base64_encode( json_encode( $stateObj ) );
131131

132+
$connection = apply_filters( 'auth0_get_auto_login_connection', $this->a0_options->get( 'auto_login_method' ) );
133+
132134
// Create the link to log in.
133135
$login_url = "https://". $this->a0_options->get( 'domain' ) .
134136
"/authorize?response_type=code&scope=openid%20profile".
135137
"&client_id=".$this->a0_options->get( 'client_id' ) .
136138
"&redirect_uri=".home_url( '/index.php?auth0=1' ) .
137139
"&state=".urlencode( $state ).
138-
"&connection=".$this->a0_options->get( 'auto_login_method' ).
140+
"&connection=". trim($connection) .
139141
"&auth0Client=" . WP_Auth0_Api_Client::get_info_headers();
140142

141143
wp_redirect( $login_url );

0 commit comments

Comments
 (0)