protected function __construct() { AADSSO_Profile::get_instance($this); $this->settings = AADSSO_Settings::load_settings(); // Set the redirect urls self::$redirect_uri = wp_login_url(); self::$logout_redirect_uri = wp_login_url(); // If plugin is not configured, we shouldn't proceed. if (!$this->plugin_is_configured()) { return; } // The authenticate filter add_filter('authenticate', array($this, 'authenticate'), 1, 3); // Some debugging locations // Add the <style> element to the login page add_action('login_enqueue_scripts', array($this, 'printLoginCss')); // Add the link to the organization's sign-in page add_action('login_form', array($this, 'printLoginLink')); add_action('login_init', array($this, 'maybeBypassLogin')); }
public static function getAccessTokenAsNativeApp($code, $settings) { // Construct the body for the access token request $authenticationRequestBody = http_build_query(array('grant_type' => 'authorization_code', 'code' => $code, 'redirect_uri' => AADSSO::redirect_uri('request_access_token_as_native_app'), 'resource' => $settings->resourceURI, 'client_id' => $settings->client_id)); return self::getAndProcessAccessToken($authenticationRequestBody, $settings); }