Skip to content

Commit

Permalink
Merge pull request #299 from auth0/dev
Browse files Browse the repository at this point in the history
v3.2.19: add auth0_get_auto_login_connection filter
  • Loading branch information
glena authored Mar 9, 2017
2 parents e87bb47 + 9cb2ab4 commit cfdfbcc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,23 @@ If the filter returns null, it will lookup by email as stated in the [How doe it
}
```

### Customize autologin connection

This filter will allow to programatically set which connection the plugin should use when autologin is enabled.

```
add_filter( 'auth0_get_auto_login_connection', 'auth0_get_auto_login_connection', 1, 1 );
function auth0_get_auto_login_connection($connection) {
if ( /* check some condition */ ) {
return 'twitter';
}
return $connection;
}
```

## API authentication

The last version of the plugin provides the ability integrate with **wp-jwt-auth** plugin to authenticate api calls via a HTTP Authorization Header.
Expand Down
6 changes: 3 additions & 3 deletions WP_Auth0.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: PLUGIN_NAME
* Description: PLUGIN_DESCRIPTION
* Version: 3.2.18
* Version: 3.2.19
* Author: Auth0
* Author URI: https://auth0.com
*/
Expand All @@ -11,7 +11,7 @@
define( 'WPA0_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
define( 'WPA0_LANG', 'wp-auth0' );
define( 'AUTH0_DB_VERSION', 13 );
define( 'WPA0_VERSION', '3.2.18' );
define( 'WPA0_VERSION', '3.2.19' );

/**
* Main plugin class
Expand Down Expand Up @@ -449,4 +449,4 @@ function get_auth0_curatedBlogName() {
}

$a0_plugin = new WP_Auth0();
$a0_plugin->init();
$a0_plugin->init();
4 changes: 3 additions & 1 deletion lib/WP_Auth0_LoginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,15 @@ public function login_auto() {
}
$state = base64_encode( json_encode( $stateObj ) );

$connection = apply_filters( 'auth0_get_auto_login_connection', $this->a0_options->get( 'auto_login_method' ) );

// Create the link to log in.
$login_url = "https://". $this->a0_options->get( 'domain' ) .
"/authorize?response_type=code&scope=openid%20profile".
"&client_id=".$this->a0_options->get( 'client_id' ) .
"&redirect_uri=".home_url( '/index.php?auth0=1' ) .
"&state=".urlencode( $state ).
"&connection=".$this->a0_options->get( 'auto_login_method' ).
"&connection=". trim($connection) .
"&auth0Client=" . WP_Auth0_Api_Client::get_info_headers();

wp_redirect( $login_url );
Expand Down

0 comments on commit cfdfbcc

Please sign in to comment.