コード例 #1
0
    def finish(self, data):
        """Process success indicator from the server.

        Process any addiitional data passed with the success.
        Fail if the server was not authenticated.

        :Parameters:
            - `data`: an optional additional data with success.
        :Types:
            - `data`: `str`

        :return: success or failure indicator.
        :returntype: `sasl.Success` or `sasl.Failure`"""
        if not self.response_auth:
            self.__logger.debug("Got success too early")
            return Failure("bad-success")
        if self.rspauth_checked:
            return Success(self.username, self.realm, self.authzid)
        else:
            r = self._final_challenge(data)
            if isinstance(r, Failure):
                return r
            if self.rspauth_checked:
                return Success(self.username, self.realm, self.authzid)
            else:
                self.__logger.debug(
                    "Something went wrong when processing additional data with success?"
                )
                return Failure("bad-success")
コード例 #2
0
ファイル: plain.py プロジェクト: sgricci/digsby
    def response(self,response):
        """Process a client reponse.

        :Parameters:
            - `response`: the response from the client.
        :Types:
            - `response`: `str`

        :return: a challenge, a success indicator or a failure indicator.
        :returntype: `sasl.Challenge`, `sasl.Success` or `sasl.Failure`"""
        s=response.split("\000")
        if len(s)!=3:
            self.__logger.debug("Bad response: %r" % (response,))
            return Failure("not-authorized")
        authzid,username,password=s
        authzid=from_utf8(authzid)
        username=from_utf8(username)
        password=from_utf8(password)
        if not self.password_manager.check_password(username,password):
            self.__logger.debug("Bad password. Response was: %r" % (response,))
            return Failure("not-authorized")
        info={"mechanism":"PLAIN","username":username}
        if self.password_manager.check_authzid(authzid,info):
            return Success(username,None,authzid)
        else:
            self.__logger.debug("Authzid verification failed.")
            return Failure("invalid-authzid")
コード例 #3
0
ファイル: external.py プロジェクト: sgricci/digsby
    def finish(self, data):
        """Handle authentication success information from the server.

        :Parameters:
            - `data`: the optional additional data returned with the success.
        :Types:
            - `data`: `str`

        :return: a success indicator.
        :returntype: `Success`"""
        _unused = data
        return Success(self.username, None, self.authzid)
コード例 #4
0
    def response(self, response):
        """Process a client reponse.

        :Parameters:
            - `response`: the response from the client.
        :Types:
            - `response`: `str`

        :return: a challenge, a success indicator or a failure indicator.
        :returntype: `sasl.Challenge`, `sasl.Success` or `sasl.Failure`"""
        if self.done:
            return Success(self.username, self.realm, self.authzid)
        if not response:
            return Failure("not-authorized")
        return self._parse_response(response)
コード例 #5
0
ファイル: chat_eg.py プロジェクト: rluse123/musings
 def finish(self, data):
     return Success(None)
コード例 #6
0
ファイル: gssapi.py プロジェクト: udaycyberitus/pyxmpp
 def finish(self, data):
     self.username = kerberos.authGSSClientUserName(self._gss)
     self.__logger.debug("Authenticated as %s" %
                         kerberos.authGSSClientUserName(self._gss))
     return Success(self.username, None, self.authzid)
コード例 #7
0
ファイル: digsbysasl.py プロジェクト: sgricci/digsby
 def finish(self, data):
     _unused = data
     return Success(self.username, None, self.authzid)