public function test_from_DOM_document_returns_instance() { $dom = new DOMDocument(); $dom->loadXML(file_get_contents(static::$idp_xml_location)); $actual = LaunchKey_WP_SSO_Config_Helper::from_DOM_document($dom); $this->assertInstanceOf("LaunchKey_WP_SSO_Config_Helper", $actual); return $actual; }
/** * @param array $errors * @param array $options * * @internal param array $input */ private function process_sso_options($input, &$errors, &$options) { if (empty($input[LaunchKey_WP_Options::OPTION_SSO_ENTITY_ID])) { $errors[] = $this->wp_facade->__('SSO Profile Entity ID is required', $this->language_domain); } else { $options[LaunchKey_WP_Options::OPTION_SSO_ENTITY_ID] = $input[LaunchKey_WP_Options::OPTION_SSO_ENTITY_ID]; } if (empty($_FILES['sso_idp']['tmp_name']) && empty($options[LaunchKey_WP_Options::OPTION_SSO_CERTIFICATE])) { $errors[] = $this->wp_facade->__('SSO Profile File is required', $this->language_domain); } else { if (!empty($_FILES['sso_idp']['tmp_name'])) { try { $idp_doc = SAML2_DOMDocumentFactory::fromString(file_get_contents($_FILES['sso_idp']['tmp_name'])); $helper = LaunchKey_WP_SSO_Config_Helper::from_DOM_document($idp_doc); $options[LaunchKey_WP_Options::OPTION_SSO_CERTIFICATE] = $helper->get_X509_certificate(); $options[LaunchKey_WP_Options::OPTION_SSO_LOGIN_URL] = $helper->get_SSO_redirect(); $options[LaunchKey_WP_Options::OPTION_SSO_LOGOUT_URL] = $helper->get_SLO_redirect(); $options[LaunchKey_WP_Options::OPTION_SSO_ERROR_URL] = $helper->get_error_redirect(); } catch (Exception $e) { $errors[] = $this->wp_facade->__('The SSO Profile file provided had an error being parsed', $this->language_domain) . ": " . $e->getMessage(); } } } }