Beispiel #1
0
 def testRequestAvatarId(self):
     db = checkers.PluggableAuthenticationModulesChecker()
     conv = self._makeConv({1: 'password', 2: 'entry', 3: ''})
     creds = credentials.PluggableAuthenticationModules('testuser', conv)
     d = db.requestAvatarId(creds)
     d.addCallback(self.assertEqual, 'testuser')
     return d
Beispiel #2
0
 def testBadUsername(self):
     db = checkers.PluggableAuthenticationModulesChecker()
     conv = self._makeConv({1: 'password', 2: 'entry', 3: ''})
     creds = credentials.PluggableAuthenticationModules('baduser', conv)
     d = db.requestAvatarId(creds)
     self.assertFailure(d, error.UnauthorizedLogin)
     return d
Beispiel #3
0
 def auth_keyboard_interactive(self, packet):
     if hasattr(self, '_pamDeferred'):
         self.transport.sendDisconnect(
             transport.DISCONNECT_PROTOCOL_ERROR,
             "only one keyboard interactive attempt at a time")
         return failure.Failure(error.IgnoreAuthentication())
     c = credentials.PluggableAuthenticationModules(self.user,
                                                    self._pamConv)
     return self.portal.login(c, None, interfaces.IConchUser)
Beispiel #4
0
 def auth_keyboard_interactive(self, packet):
     """
     Keyboard interactive authentication.  No payload.  We create a
     PluggableAuthenticationModules credential and authenticate with our
     portal.
     """
     if self._pamDeferred is not None:
         self.transport.sendDisconnect(
                 transport.DISCONNECT_PROTOCOL_ERROR,
                 "only one keyboard interactive attempt at a time")
         return defer.fail(error.IgnoreAuthentication())
     c = credentials.PluggableAuthenticationModules(self.user,
             self._pamConv)
     return self.portal.login(c, None, interfaces.IConchUser)
Beispiel #5
0
    def remote_login(self, creds, mind):
        """Start of username/password login."""

        username = creds['username']
        password = creds['password']
        self.mUPCred = credentials.UsernamePassword(username, password)

        if 'win32' == sys.platform:
            domain = creds['domain']
            import winchecker
            self.mWindowsCred = winchecker.WindowsUsernamePassword(
                username, password, domain)
            d = self.portal.login(self.mWindowsCred, mind, pb.IPerspective)
        else:
            import pamchecker
            conv = pamchecker.makeConv({1: password, 2: username, 3: ''})
            self.mPAMCred = credentials.PluggableAuthenticationModules(
                username, conv)
            d = self.portal.login(self.mPAMCred, mind, pb.IPerspective)

        d.addCallback(self._loggedIn, creds)
        #.addErrback(self.tryNext, mind)
        return d