diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2016-09-29 13:51:44 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2016-09-29 13:51:44 +0300 |
commit | 62f28d30a069135f9c48678507203958adfc334f (patch) | |
tree | 7f38af0c8d3f445ee8cc50906a639baec7011127 /pkgs/icingaweb2 | |
parent | 1af9e6589bdd18e6ba7eeabf073aa7d710020cdd (diff) | |
download | nixsap-62f28d30a069135f9c48678507203958adfc334f.tar.gz |
Moved everything into ./modules
Diffstat (limited to 'pkgs/icingaweb2')
-rw-r--r-- | pkgs/icingaweb2/default.nix | 33 | ||||
-rw-r--r-- | pkgs/icingaweb2/sproxy.patch | 78 |
2 files changed, 0 insertions, 111 deletions
diff --git a/pkgs/icingaweb2/default.nix b/pkgs/icingaweb2/default.nix deleted file mode 100644 index 263ae47..0000000 --- a/pkgs/icingaweb2/default.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ stdenv, fetchurl -, php -}: - -stdenv.mkDerivation rec { - version = "2.3.4"; - name = "icingaweb2-${version}"; - - src = fetchurl { - url = "https://github.com/Icinga/icingaweb2/archive/v${version}.tar.gz"; - sha256 = "0kmxvwbr7g6daj2mqabzvmw3910igd85wrzwilkz83fizgmrszh5"; - }; - - buildInputs = [ php ]; - - patches = [ ./sproxy.patch ]; - - buildPhase = "true"; - - installPhase = '' - mkdir -p $out - cp -a * $out - rm -rf $out/.puppet - rm -rf $out/Vagrantfile - rm -rf $out/icingaweb2.spec - rm -rf $out/modules/doc - rm -rf $out/modules/iframe - rm -rf $out/modules/setup - rm -rf $out/modules/test - rm -rf $out/packages - rm -rf $out/test - ''; -} diff --git a/pkgs/icingaweb2/sproxy.patch b/pkgs/icingaweb2/sproxy.patch deleted file mode 100644 index d1b074d..0000000 --- a/pkgs/icingaweb2/sproxy.patch +++ /dev/null @@ -1,78 +0,0 @@ -commit 04eb7cffa84387070f48f5649a1d5a5a7843fc9c -Author: Igor Pashev <pashev.igor@gmail.com> -Date: Fri Jan 1 11:05:48 2016 +0300 - - Added Sproxy backend - - See https://github.com/zalora/sproxy - -diff --git a/library/Icinga/Authentication/User/SproxyBackend.php b/library/Icinga/Authentication/User/SproxyBackend.php -new file mode 100644 -index 0000000..4b15b0e ---- /dev/null -+++ b/library/Icinga/Authentication/User/SproxyBackend.php -@@ -0,0 +1,40 @@ -+<?php -+/* 2016 Zalora South East Asia Pte. Ltd | GPLv2+ */ -+ -+namespace Icinga\Authentication\User; -+ -+use Icinga\Data\ConfigObject; -+use Icinga\User; -+ -+/** -+ * Login with Sproxy authentication mechanism: -+ * https://github.com/zalora/sproxy -+ */ -+class SproxyBackend extends ExternalBackend -+{ -+ /** -+ * {@inheritdoc} -+ */ -+ public function authenticate(User $user, $password = null) -+ { -+ if (! empty($_SERVER['HTTP_FROM'])) { -+ $email = $_SERVER['HTTP_FROM']; -+ $user->setUsername($email); -+ $user->setEmail($email); -+ $user->setExternalUserInformation($email, 'HTTP_FROM'); -+ -+ if (! empty($_SERVER['HTTP_X_GIVEN_NAME'])) { -+ $user->setFirstname($_SERVER['HTTP_X_GIVEN_NAME']); -+ } -+ if (! empty($_SERVER['HTTP_X_GROUPS'])) { -+ $user->setGroups(explode(',', $_SERVER['HTTP_X_GROUPS'])); -+ } -+ if (! empty($_SERVER['HTTP_X_FAMILY_NAME'])) { -+ $user->setLastname($_SERVER['HTTP_X_FAMILY_NAME']); -+ } -+ -+ return true; -+ } -+ return false; -+ } -+} -diff --git a/library/Icinga/Authentication/User/UserBackend.php b/library/Icinga/Authentication/User/UserBackend.php -index 3b8e210..d264365 100644 ---- a/library/Icinga/Authentication/User/UserBackend.php -+++ b/library/Icinga/Authentication/User/UserBackend.php -@@ -22,6 +22,7 @@ class UserBackend implements ConfigAwareFactory - * @var array - */ - protected static $defaultBackends = array( -+ 'sproxy', - 'external', - 'db', - 'ldap', -@@ -176,6 +177,11 @@ class UserBackend implements ConfigAwareFactory - $backend->setName($name); - return $backend; - } -+ if ($backendType === 'sproxy') { -+ $backend = new SproxyBackend($backendConfig); -+ $backend->setName($name); -+ return $backend; -+ } - if (in_array($backendType, static::$defaultBackends)) { - // The default backend check is the first one because of performance reasons: - // Do not attempt to load a custom user backend unless it's actually required |