Author: sevein
Date: Sat Oct  8 03:22:15 2011
New Revision: 9986

Log:
Skeleton of filter implementing HTTP Basic Authentication under qtSwordPlugin 
module. SWORD should be capable of being configured to use HTTP Basic 
Authentication in conjunction with a TLS connection. See SWORDv1.3 
specification for more details.

Added:
   trunk/plugins/qtSwordPlugin/lib/
   trunk/plugins/qtSwordPlugin/lib/qtSwordPluginHttpAuthFilter.class.php
   trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/config/
   trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/config/filters.yml

Added: trunk/plugins/qtSwordPlugin/lib/qtSwordPluginHttpAuthFilter.class.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/plugins/qtSwordPlugin/lib/qtSwordPluginHttpAuthFilter.class.php       
Sat Oct  8 03:22:15 2011        (r9986)
@@ -0,0 +1,43 @@
+<?php
+
+/*
+ * This file is part of Qubit Toolkit.
+ *
+ * Qubit Toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Qubit Toolkit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Qubit Toolkit.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+class qtSwordPluginHttpAuthFilter extends sfFilter
+{
+  public function execute($filterChain)
+  {
+    if ($this->isFirstCall())
+    {
+      if (!isset($_SERVER['PHP_AUTH_USER']))
+      {
+        $this->sendHeadersAndExit();
+      }
+
+      // TODO: check user and password
+    }
+
+    $filterChain->execute();
+  }
+
+  private function sendHeadersAndExit()
+  {
+    header('WWW-Authenticate: Basic realm="' . sfConfig::get('app_auth_realm') 
. '"');
+    header('HTTP/1.0 401 Unauthorized');
+    exit;
+  }
+}

Added: trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/config/filters.yml
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/plugins/qtSwordPlugin/modules/qtSwordPlugin/config/filters.yml        
Sat Oct  8 03:22:15 2011        (r9986)
@@ -0,0 +1,22 @@
+httpAuthFilter:
+  class: qtSwordPluginHttpAuthFilter
+
+# Disable other filters
+# http://trac.symfony-project.org/ticket/1748
+
+transaction:
+  class: QubitTransactionFilter
+  enabled: off
+
+history:
+  class: sfHistoryPluginFilter
+  enabled: off
+
+siteSettingsFilter:
+  class: siteSettingsFilter
+  enabled: off
+
+rendering: ~
+security: ~
+cache:     ~
+execution: ~

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to