Move some exceptions into provider.common
authorSimo Sorce <simo@redhat.com>
Tue, 7 Oct 2014 15:00:37 +0000 (11:00 -0400)
committerPatrick Uiterwijk <puiterwijk@redhat.com>
Fri, 24 Oct 2014 16:02:20 +0000 (18:02 +0200)
These are generically useful and can be rused as they are by other
providers.

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
ipsilon/providers/common.py
ipsilon/providers/saml2/auth.py

index b1968f4..6d454b5 100755 (executable)
@@ -34,6 +34,21 @@ class ProviderException(Exception, Log):
         return repr(self.message)
 
 
+class AuthenticationError(ProviderException):
+
+    def __init__(self, message, code):
+        super(AuthenticationError, self).__init__(message)
+        self.code = code
+        self._debug('%s [%s]' % (message, code))
+
+
+class InvalidRequest(ProviderException):
+
+    def __init__(self, message):
+        super(InvalidRequest, self).__init__(message)
+        self._debug(message)
+
+
 class ProviderBase(PluginObject):
 
     def __init__(self, name, path):
index 861ef96..cbfeaaa 100755 (executable)
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from ipsilon.providers.common import ProviderPageBase, ProviderException
+from ipsilon.providers.common import AuthenticationError, InvalidRequest
 from ipsilon.providers.saml2.provider import ServiceProvider
 from ipsilon.providers.saml2.provider import InvalidProviderId
 from ipsilon.providers.saml2.provider import NameIdNotAllowed
@@ -28,21 +29,6 @@ import datetime
 import lasso
 
 
-class AuthenticationError(ProviderException):
-
-    def __init__(self, message, code):
-        super(AuthenticationError, self).__init__(message)
-        self.code = code
-        self._debug('%s [%s]' % (message, code))
-
-
-class InvalidRequest(ProviderException):
-
-    def __init__(self, message):
-        super(InvalidRequest, self).__init__(message)
-        self._debug(message)
-
-
 class UnknownProvider(ProviderException):
 
     def __init__(self, message):