From 2c844389fd6eb1ae24c3cc9d96d30dda7b598e94 Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Sun, 11 Feb 2018 08:32:30 -0500 Subject: [PATCH] Adding a new filter for the auth token --- aad-sso-wordpress.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/aad-sso-wordpress.php b/aad-sso-wordpress.php index 952b5f4..1f629c0 100644 --- a/aad-sso-wordpress.php +++ b/aad-sso-wordpress.php @@ -271,6 +271,18 @@ function authenticate( $user, $username, $password ) { // Looks like we got a valid authorization code, let's try to get an access token with it $token = AADSSO_AuthorizationHelper::get_access_token( $_GET['code'], $this->settings ); + /** + * Allow filtering of the token in order to use alternate AAD applications to sign in. + * + * @param mixed $token The token returned from the standard auth call + * @param string The $_GET['code'] variable + * @param \AADSSO_Settings The settings object for the AADSSO instance. + * @since 0.6.2 + * + * @return mixed + */ + $token = apply_filters( 'addsso_auth_token', $token, $_GET['code'], $this->settings ); + // Happy path if ( isset( $token->access_token ) ) {