Esempio n. 1
0
 def requestAvatarId(self, credentials):
     ifac = providedBy(credentials)
     for i in ifac:
         c = self.checkers.get(i)
         if c is not None:
             return c.requestAvatarId(credentials).addCallback(
                 self._cbGoodAuthentication, credentials)
     return defer.fail(UnhandledCredentials("No checker for %s" % \
         ', '.join(map(reflect.qal, ifac))))
Esempio n. 2
0
 def requestAvatarId(self, credentials):
     if hasattr(credentials, 'password'):
         if self.checkUserPass(credentials.username, credentials.password):
             return defer.succeed(credentials.username)
         else:
             return defer.fail(UnauthorizedLogin())
     elif hasattr(credentials, 'pamConversion'):
         return self.checkPamUser(credentials.username,
                                  credentials.pamConversion)
     return defer.fail(UnhandledCredentials())
Esempio n. 3
0
    def requestAvatarId(self, credentials):
        """
        Part of the L{ICredentialsChecker} interface.  Called by a portal with
        some credentials to check if they'll authenticate a user.  We check the
        interfaces that the credentials provide against our list of acceptable
        checkers.  If one of them matches, we ask that checker to verify the
        credentials.  If they're valid, we call our L{_cbGoodAuthentication}
        method to continue.

        @param credentials: the credentials the L{Portal} wants us to verify
        """
        ifac = providedBy(credentials)
        for i in ifac:
            c = self.checkers.get(i)
            if c is not None:
                d = defer.maybeDeferred(c.requestAvatarId, credentials)
                return d.addCallback(self._cbGoodAuthentication, credentials)
        return defer.fail(UnhandledCredentials("No checker for %s" % \
            ', '.join(map(reflect.qual, ifac))))