|
Lines 247-268
class AuthHandler( signals.Provider ):
Link Here
|
| 247 |
self.signal_new( 'authenticated' ) |
247 |
self.signal_new( 'authenticated' ) |
| 248 |
self.__credentials = None |
248 |
self.__credentials = None |
| 249 |
|
249 |
|
| 250 |
def _create_modules( self, username, password ): |
250 |
def _create_modules( self, **kwargs ): |
| 251 |
global _all_modules |
251 |
global _all_modules |
| 252 |
self._modules = [] |
252 |
self._modules = [] |
| 253 |
for mod in _all_modules: |
253 |
for mod in _all_modules: |
| 254 |
instance = mod( username, password ) |
254 |
try: |
| 255 |
instance.signal_connect( 'auth_return', self._auth_return ) |
255 |
instance = mod( kwargs['username'] , kwargs['password'] ) |
| 256 |
instance.signal_connect( 'password_changed', self._password_changed ) |
256 |
instance.signal_connect( 'auth_return', self._auth_return ) |
| 257 |
self._modules.append( instance ) |
257 |
instance.signal_connect( 'password_changed', self._password_changed ) |
|
|
258 |
self._modules.append( instance ) |
| 259 |
except Exception, e: |
| 260 |
AUTH.warn( "AuthHandler - _create_modules error: %s" % str( e ) ) |
| 258 |
self._modules.reverse() |
261 |
self._modules.reverse() |
|
|
262 |
|
| 263 |
def authenticate( self, **kwargs ): |
| 264 |
try: |
| 265 |
if kwargs['auth_type'] == "saml": |
| 266 |
AUTH.warn('__starting SAML Authenticate __') |
| 267 |
|
| 268 |
self._create_modules( **kwargs ) |
| 269 |
self._current = self._modules.pop() |
| 270 |
self.__new_password = kwargs['new_password'] |
| 271 |
self._current.authenticate() |
| 272 |
self.__credentials = ( kwargs['username'], kwargs['password'] ) |
| 273 |
except Exception, e: |
| 274 |
AUTH.warn( "authenticate.... error: %s" % str( e ) ) |
| 259 |
|
275 |
|
| 260 |
def authenticate( self, username, password, new_password=None ): |
|
|
| 261 |
self._create_modules( username, password ) |
| 262 |
self._current = self._modules.pop() |
| 263 |
self.__new_password = new_password |
| 264 |
self._current.authenticate() |
| 265 |
self.__credentials = ( username, password ) |
| 266 |
|
276 |
|
| 267 |
def credentials( self ): |
277 |
def credentials( self ): |
| 268 |
return self.__credentials |
278 |
return self.__credentials |