summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-07-28 10:39:05 +0200
committerRemi Collet <fedora@famillecollet.com>2016-07-28 10:39:05 +0200
commitc03d9fc89a33f6a6ef3740d70036961a627d04a2 (patch)
tree3b3536ee917b2a3a01dd8242bdaa75c370e680c2
php-onelogin-php-saml: import from Fedora
-rw-r--r--php-onelogin-php-saml.spec117
-rw-r--r--php-saml-bootstrap-autoloader.patch57
2 files changed, 174 insertions, 0 deletions
diff --git a/php-onelogin-php-saml.spec b/php-onelogin-php-saml.spec
new file mode 100644
index 0000000..afe6bb0
--- /dev/null
+++ b/php-onelogin-php-saml.spec
@@ -0,0 +1,117 @@
+%global gh_commit 17bfafe301bf21be1827c72f90e33a9c29d58553
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner onelogin
+%global gh_project php-saml
+%global php_vendor OneLogin
+
+%global php_minver 5.3.2
+
+Name: php-%{gh_owner}-%{gh_project}
+Version: 2.9.1
+Release: 3%{?dist}
+Summary: SAML support for PHP
+
+License: MIT
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: %{url}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz
+
+# Patch the test bootstrap for our autoload.php rather than adjust in %%check to simplify spec
+Patch0: php-saml-bootstrap-autoloader.patch
+
+BuildArch: noarch
+
+BuildRequires: php(language) >= %{php_minver}
+BuildRequires: %{_bindir}/phpab
+BuildRequires: %{_bindir}/phpunit
+BuildRequires: php-mcrypt
+
+# For %%check testing
+BuildRequires: php-composer(robrichards/xmlseclibs) >= 1.4.1
+BuildRequires: php-composer(robrichards/xmlseclibs) < 2.0.0
+
+# From composer.json, "require": {
+# "php": ">=5.3.2"
+Requires: php(language) >= %{php_minver}
+Requires: php-openssl
+Requires: php-dom
+
+# From manual unbundling, needs 1.4 contrary to the bundled 2.0 due to namespace issues
+Requires: php-composer(robrichards/xmlseclibs) >= 1.4.1
+Requires: php-composer(robrichards/xmlseclibs) < 2.0.0
+
+# From phpci analysis
+Requires: php-date
+Requires: php-filter
+Requires: php-hash
+Requires: php-libxml
+Requires: php-pcre
+Requires: php-session
+Requires: php-zlib
+
+%if 0%{?rhel}
+Requires: php-gettext
+%else
+Suggests: php-gettext
+%endif
+
+# Uses the mcrypt algorithms which is a suggests in xmlseclibs
+Requires: php-mcrypt
+
+Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version}
+
+
+%description
+OneLogin's SAML PHP toolkit let you build a SP (Service Provider) over
+your PHP application and connect it to any IdP (Identity Provider).
+
+Autoloader: %{_datadir}/php/%{php_vendor}/Saml2/autoload.php
+
+
+%prep
+%autosetup -n %{gh_project}-%{gh_commit} -p1
+
+
+%build
+rm -rf extlib
+: Generate autoloader
+%{_bindir}/phpab -n --output lib/Saml2/autoload.php lib
+# Append the xmlseclibs requirement not in composer
+cat >> lib/Saml2/autoload.php <<EOF
+require_once "%{_datadir}/php/robrichards-xmlseclibs/autoload.php";
+EOF
+
+
+%install
+mkdir -p %{buildroot}%{_datadir}/php/%{php_vendor}
+cp -pr lib/* %{buildroot}%{_datadir}/php/%{php_vendor}/
+
+
+%check
+: Run upstream phpunit tests in dev mode
+%{_bindir}/php -c %{_docdir}/php/php.ini-development %{_bindir}/phpunit --verbose --debug --bootstrap tests/bootstrap.php --configuration tests/phpunit.xml
+: Run upstream phpunit tests in system settings mode
+%{_bindir}/php %{_bindir}/phpunit --verbose --debug --bootstrap tests/bootstrap.php --configuration tests/phpunit.xml
+
+
+
+
+
+%files
+%license LICENSE
+%doc advanced_settings_example.php settings_example.php README.md composer.json CHANGELOG
+%{_datadir}/php/%{php_vendor}
+
+
+%changelog
+* Mon Jul 25 2016 James Hogarth <james.hogarth@gmail.com> - 2.9.1-3
+- Switch to a single autoloader after feedback
+
+* Mon Jul 25 2016 James Hogarth <james.hogarth@gmail.com> - 2.9.1-2
+- Update spec with comments from review
+
+* Wed Jul 20 2016 James Hogarth <james.hogarth@gmail.com> - 2.9.1-1
+- update to 2.9.1
+
+* Wed Jul 13 2016 James Hogarth <james.hogarth@gmail.com> - 2.9.0-1
+- initial package
+
diff --git a/php-saml-bootstrap-autoloader.patch b/php-saml-bootstrap-autoloader.patch
new file mode 100644
index 0000000..baac69b
--- /dev/null
+++ b/php-saml-bootstrap-autoloader.patch
@@ -0,0 +1,57 @@
+diff --git a/tests/bootstrap.php b/tests/bootstrap.php
+index 4c27cc8..c73448f 100644
+--- a/tests/bootstrap.php
++++ b/tests/bootstrap.php
+@@ -4,20 +4,11 @@ ob_start();
+
+ $basePath = dirname(dirname(__FILE__));
+
+-require_once $basePath.'/_toolkit_loader.php';
++require_once $basePath.'/lib/Saml2/autoload.php';
++
+
+ if (!defined('TEST_ROOT')) define('TEST_ROOT', dirname(__FILE__));
+
+-if (!defined('XMLSECLIBS_DIR')) define('XMLSECLIBS_DIR', $basePath.'/extlib/xmlseclibs/');
+-require_once XMLSECLIBS_DIR . 'xmlseclibs.php';
+-
+-if (!defined('ONELOGIN_SAML_DIR')) define('ONELOGIN_SAML_DIR', $basePath.'/lib/Saml/');
+-require_once ONELOGIN_SAML_DIR . 'AuthRequest.php';
+-require_once ONELOGIN_SAML_DIR . 'Response.php';
+-require_once ONELOGIN_SAML_DIR . 'Settings.php';
+-require_once ONELOGIN_SAML_DIR . 'Metadata.php';
+-require_once ONELOGIN_SAML_DIR . 'XmlSec.php';
+-
+ if (!defined('ONELOGIN_CUSTOMPATH')) {
+ define('ONELOGIN_CUSTOMPATH', dirname(__FILE__).'/data/customPath/');
+ }
+@@ -29,12 +20,12 @@ if (!function_exists('getUrlFromRedirect')) {
+ /**
+ * In phpunit when a redirect is executed an Excepion raise,
+ * this funcion Get the target URL of the redirection
+- *
++ *
+ * @param array $trace Trace of the Stack when an Exception raised
+ *
+ * @return string $targeturl Target url of the redirection
+ */
+- function getUrlFromRedirect($trace)
++ function getUrlFromRedirect($trace)
+ {
+ $param_args = $trace[0]['args'][4];
+ $targeturl = $param_args['url'];
+@@ -45,12 +36,12 @@ if (!function_exists('getUrlFromRedirect')) {
+ if (!function_exists('getParamsFromUrl')) {
+ /**
+ * Parsed the Query parameters of an URL.
+- *
++ *
+ * @param string $url The URL
+ *
+ * @return array $parsedQuery Parsed query of the url
+ */
+- function getParamsFromUrl($url)
++ function getParamsFromUrl($url)
+ {
+ $parsedUrl = parse_url($url);
+ $query = $parsedUrl['query'];