aboutsummaryrefslogtreecommitdiff
path: root/src/SemanticScuttle/Model/User/SslClientCert.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2011-05-09 18:16:53 +0200
committerChristian Weiske <cweiske@cweiske.de>2011-05-09 18:16:53 +0200
commit967ba79ece58dd0164accbf46078964c58fec230 (patch)
tree07711ae871ac8f32b581216eb3c15c900995fecb /src/SemanticScuttle/Model/User/SslClientCert.php
parent2fba3020034cae12c244713311a7c76d5a6a4800 (diff)
downloadsemanticscuttle-967ba79ece58dd0164accbf46078964c58fec230.tar.gz
semanticscuttle-967ba79ece58dd0164accbf46078964c58fec230.tar.bz2
show current users certificates on profile page
Diffstat (limited to 'src/SemanticScuttle/Model/User/SslClientCert.php')
-rw-r--r--src/SemanticScuttle/Model/User/SslClientCert.php72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/SemanticScuttle/Model/User/SslClientCert.php b/src/SemanticScuttle/Model/User/SslClientCert.php
new file mode 100644
index 0000000..ab7b288
--- /dev/null
+++ b/src/SemanticScuttle/Model/User/SslClientCert.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license AGPL http://www.gnu.org/licenses/agpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+
+/**
+ * SSL client certificate model. Represents one single client certificate
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license AGPL http://www.gnu.org/licenses/agpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+class SemanticScuttle_Model_User_SslClientCert
+{
+ public $id;
+ public $uId;
+ public $sslSerial;
+ public $sslClientIssuerDn;
+ public $sslName;
+ public $sslEmail;
+
+ /**
+ * Creates and returns a new object and fills it with
+ * tha passed values from the database.
+ *
+ * @param array $arCertRow Database row array
+ *
+ * @return SemanticScuttle_Model_User_SslClientCert
+ */
+ public static function fromDb($arCertRow)
+ {
+ $cert = new self();
+ foreach (get_object_vars($cert) as $variable => $dummy) {
+ if (isset($arCertRow[$variable])) {
+ $cert->$variable = $arCertRow[$variable];
+ }
+ }
+ return $cert;
+ }
+
+
+
+ /**
+ * Tells you if this certificate is the one the user is currently browsing
+ * with.
+ *
+ * @return boolean True if this certificate is the current browser's
+ */
+ public function isCurrent()
+ {
+ if (!isset($_SERVER['SSL_CLIENT_M_SERIAL'])
+ || !isset($_SERVER['SSL_CLIENT_I_DN'])
+ ) {
+ return false;
+ }
+
+ return $this->sslSerial == $_SERVER['SSL_CLIENT_M_SERIAL']
+ && $this->sslClientIssuerDn == $_SERVER['SSL_CLIENT_I_DN'];
+ }
+
+}
+?> \ No newline at end of file