当前位置: 首页>>代码示例>>Python>>正文


Python twisted.cred方法代码示例

本文整理汇总了Python中twisted.cred方法的典型用法代码示例。如果您正苦于以下问题:Python twisted.cred方法的具体用法?Python twisted.cred怎么用?Python twisted.cred使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted的用法示例。


在下文中一共展示了twisted.cred方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _cbAnonymousAuthentication

# 需要导入模块: import twisted [as 别名]
# 或者: from twisted import cred [as 别名]
def _cbAnonymousAuthentication(self, result):
        """
        Save the state resulting from a successful anonymous cred login.
        """
        (iface, avatar, logout) = result
        if issubclass(iface, IMessageDeliveryFactory):
            self.deliveryFactory = avatar
            self.delivery = None
        elif issubclass(iface, IMessageDelivery):
            self.deliveryFactory = None
            self.delivery = avatar
        else:
            raise RuntimeError("%s is not a supported interface" % (iface.__name__,))
        self._onLogout = logout
        self.challenger = None


    # overridable methods: 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:20,代码来源:smtp.py

示例2: _ebAuthenticated

# 需要导入模块: import twisted [as 别名]
# 或者: from twisted import cred [as 别名]
def _ebAuthenticated(self, reason):
        """
        Handle cred login errors by translating them to the SMTP authenticate
        failed.  Translate all other errors into a generic SMTP error code and
        log the failure for inspection.  Stop all errors from propagating.

        @param reason: Reason for failure.
        """
        self.challenge = None
        if reason.check(cred.error.UnauthorizedLogin):
            self.sendCode(535, b'Authentication failed')
        else:
            log.err(reason, "SMTP authentication failure")
            self.sendCode(
                451,
                b'Requested action aborted: local error in processing') 
开发者ID:wistbean,项目名称:learn_python3_spider,代码行数:18,代码来源:smtp.py

示例3: _cbAuthenticated

# 需要导入模块: import twisted [as 别名]
# 或者: from twisted import cred [as 别名]
def _cbAuthenticated(self, loginInfo):
        """
        Save the state resulting from a successful cred login and mark this
        connection as authenticated.
        """
        result = SMTP._cbAnonymousAuthentication(self, loginInfo)
        self.authenticated = True
        return result 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:10,代码来源:smtp.py

示例4: _ebAuthenticated

# 需要导入模块: import twisted [as 别名]
# 或者: from twisted import cred [as 别名]
def _ebAuthenticated(self, reason):
        """
        Handle cred login errors by translating them to the SMTP authenticate
        failed.  Translate all other errors into a generic SMTP error code and
        log the failure for inspection.  Stop all errors from propagating.
        """
        self.challenge = None
        if reason.check(cred.error.UnauthorizedLogin):
            self.sendCode(535, 'Authentication failed')
        else:
            log.err(reason, "SMTP authentication failure")
            self.sendCode(
                451,
                'Requested action aborted: local error in processing') 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:16,代码来源:smtp.py

示例5: brokerAttached

# 需要导入模块: import twisted [as 别名]
# 或者: from twisted import cred [as 别名]
def brokerAttached(self, reference, identity, broker):
        """An intermediary method to override.

        Normally you will want to use 'attached', as described in
        L{twisted.cred.perspective.Perspective}.attached; however, this method
        serves the same purpose, and in some circumstances, you are sure that
        the protocol that objects will be attaching to your Perspective with is
        Perspective Broker, and in that case you may wish to get the Broker
        object they are connecting with, for example, to determine what host
        they are connecting from.  Bear in mind that when overriding this
        method, other, non-PB protocols will not notify you of being attached
        or detached.
        """
        warnings.warn("pb.Perspective is deprecated, please use pb.Avatar.", DeprecationWarning, 2)
        return self.attached(reference, identity) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:17,代码来源:pb.py

示例6: _cbLogInResponded

# 需要导入模块: import twisted [as 别名]
# 或者: from twisted import cred [as 别名]
def _cbLogInResponded(identity, d, client, serviceName, perspectiveName):
    warnings.warn("This is deprecated. Use PBClientFactory.", DeprecationWarning, 2)
    if identity:
        identity.callRemote("attach", serviceName, perspectiveName, client).chainDeferred(d)
    else:
        from twisted import cred
        d.errback(cred.error.Unauthorized("invalid username or password")) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:9,代码来源:pb.py

示例7: _cbGotIdentity

# 需要导入模块: import twisted [as 别名]
# 或者: from twisted import cred [as 别名]
def _cbGotIdentity(self, i):
         self._identityWrapper = i
         if i:
             for d in self._connectDeferreds:
                 d.callback(i)
             self._connectDeferreds[:] = []
         else:
             from twisted import cred
             e = cred.error.Unauthorized("invalid username or password")
             self._ebGotIdentity(e) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:12,代码来源:pb.py

示例8: login

# 需要导入模块: import twisted [as 别名]
# 或者: from twisted import cred [as 别名]
def login(self, credentials, client=None):
        """Login and get perspective from remote PB server.

        Currently only credentials implementing
        L{twisted.cred.credentials.IUsernamePassword} are supported.

        @return: Deferred of RemoteReference to the perspective.
        """
        d = self.getRootObject()
        d.addCallback(self._cbSendUsername, credentials.username, credentials.password, client)
        return d 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:13,代码来源:pb.py


注:本文中的twisted.cred方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。