protected function setUp()
 {
     Phake::initAnnotations($this);
     Phake::when($this->container)->generateId(Phake::anyParameters())->thenReturn(static::UNIQUE_ID);
     SAML2_Compat_ContainerSingleton::setContainer($this->container);
     $this->service = new LaunchKey_WP_SAML2_Request_Service(self::$key);
     $this->service->load_saml_request(self::$request_data);
 }
 /**
  * @param string $saml_request
  *
  * @return null
  *
  * @since 1.1.0
  */
 private function handle_saml_request($saml_request)
 {
     $this->saml_request_service->load_saml_request($saml_request);
     if (!$this->saml_request_service->is_timestamp_within_restrictions($this->wp_facade->time())) {
         $this->wp_facade->wp_die('Invalid Request', 400);
     } elseif (!$this->saml_request_service->is_valid_destination($this->wp_facade->wp_login_url())) {
         $this->wp_facade->wp_die('Invalid Request', 400);
     } elseif (!($user = $this->wp_facade->get_user_by('login', $this->saml_request_service->get_name()))) {
         $this->wp_facade->wp_die('Invalid Request', 400);
     } elseif ($this->saml_request_service->get_session_index() != $user->get("launchkey_sso_session")) {
         $this->wp_facade->wp_die('Invalid Request', 400);
     } else {
         $this->wp_facade->update_user_meta($user->ID, 'launchkey_authorized', 'false');
     }
 }