summaryrefslogtreecommitdiffstats
path: root/lib/SimpleSAML/Error/AuthSource.php
diff options
context:
space:
mode:
authorOlav Morken <olav.morken@uninett.no>2011-04-12 13:44:19 +0000
committerOlav Morken <olav.morken@uninett.no>2011-04-12 13:44:19 +0000
commit7644eb4e1b811d1a3e65ac5e1b0e2399e7debe2c (patch)
treec44f52fee311bd58697c01645a5a8fc5d98f9fed /lib/SimpleSAML/Error/AuthSource.php
parent4f096edc1a10e9fb5be9379927a92ede27f3055e (diff)
downloadsimplesamlphp-7644eb4e1b811d1a3e65ac5e1b0e2399e7debe2c.zip
simplesamlphp-7644eb4e1b811d1a3e65ac5e1b0e2399e7debe2c.tar.gz
simplesamlphp-7644eb4e1b811d1a3e65ac5e1b0e2399e7debe2c.tar.bz2
Update Error_AuthSource to become a standard base class for authsource
errors. Thanks to Andjelko Horvat for adding this. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2812 44740490-163a-0410-bde0-09ae8108e29a
Diffstat (limited to 'lib/SimpleSAML/Error/AuthSource.php')
-rw-r--r--lib/SimpleSAML/Error/AuthSource.php59
1 files changed, 57 insertions, 2 deletions
diff --git a/lib/SimpleSAML/Error/AuthSource.php b/lib/SimpleSAML/Error/AuthSource.php
index 6e353d5..7df5cad 100644
--- a/lib/SimpleSAML/Error/AuthSource.php
+++ b/lib/SimpleSAML/Error/AuthSource.php
@@ -2,12 +2,67 @@
/**
* Baseclass for auth source exceptions.
*
- * @author Thomas Graff <thomas.graff@uninett.no>
* @package simpleSAMLphp_base
* @version $Id$
*
*/
-class SimpleSAML_Error_AuthSource extends SimpleSAML_Error_Exception{
+class SimpleSAML_Error_AuthSource extends SimpleSAML_Error_Error {
+
+
+ /**
+ * Authsource module name.
+ */
+ private $authsource;
+
+
+ /**
+ * Reason why this request was invalid.
+ */
+ private $reason;
+
+
+ /**
+ * Create a new AuthSource error.
+ *
+ * @param string $authsource Authsource module name from where this error was thrown.
+ * @param string $reason Description of the error.
+ */
+ public function __construct($authsource, $reason, $cause = NULL) {
+ assert('is_string($authsource)');
+ assert('is_string($reason)');
+
+ $this->authsource = $authsource;
+ $this->reason = $reason;
+ parent::__construct(
+ array(
+ 'AUTHSOURCEERROR',
+ '%AUTHSOURCE%' => htmlspecialchars(var_export($this->authsource, TRUE)),
+ '%REASON%' => htmlspecialchars(var_export($this->reason, TRUE))
+ ),
+ $cause
+ );
+ }
+
+
+ /**
+ * Retrieve the authsource module name from where this error was thrown.
+ *
+ * @return string Authsource module name.
+ */
+ public function getAuthSource() {
+ return $this->authsource;
+ }
+
+
+ /**
+ * Retrieve the reason why the request was invalid.
+ *
+ * @return string The reason why the request was invalid.
+ */
+ public function getReason() {
+ return $this->reason;
+ }
+
}