當前位置: 首頁>>代碼示例>>Python>>正文


Python ConchUser.channelLookup['session']方法代碼示例

本文整理匯總了Python中twisted.conch.avatar.ConchUser.channelLookup['session']方法的典型用法代碼示例。如果您正苦於以下問題:Python ConchUser.channelLookup['session']方法的具體用法?Python ConchUser.channelLookup['session']怎麽用?Python ConchUser.channelLookup['session']使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在twisted.conch.avatar.ConchUser的用法示例。


在下文中一共展示了ConchUser.channelLookup['session']方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: requestAvatar

# 需要導入模塊: from twisted.conch.avatar import ConchUser [as 別名]
# 或者: from twisted.conch.avatar.ConchUser import channelLookup['session'] [as 別名]
    def requestAvatar(self, username, mind, *interfaces):
        """"
        The connection has already been authenticated at this point. Our job
        is to return some objects representing the logged in user.

        `username' is also known as the Avatar ID in `twisted.cred' terminology.
        """

        try:
            # treat username as an OTP and attempt 
            transport, protocol = self.tickets.pop(username)

            # reset routing ticket since it is one-time only.
            ticket = tickets.newTicket()
            self.tickets[ticket] = (transport, protocol)
            log.msg("Reset routing ticket from %s to %s" % (username, ticket,))

            u = ConchUser()
           
            # Add a custom field to indicate that this connection
            # is going to be connected (routed) using this ticket.
            u._connectTo = (transport, protocol)

            u.factory = self.factory
            u.options = self.factory.options
            return IConchUser, u, lambda:None

        except KeyError:
            log.msg('Username %r not recognized as access ticket. Connecting to public AMP subsystem only!' % (username,))
            # logged in user gets access to AMP subsystem only. No shells.
            u = ConchUser()
            u.factory = self.factory
            u.options = self.factory.options
            u.channelLookup['session'] = AMPSession
            return IConchUser, u, lambda:None
開發者ID:bollustrado,項目名稱:twisted_conch_pytexas_12,代碼行數:37,代碼來源:server.py

示例2: requestAvatar

# 需要導入模塊: from twisted.conch.avatar import ConchUser [as 別名]
# 或者: from twisted.conch.avatar.ConchUser import channelLookup['session'] [as 別名]
 def requestAvatar(self, avatarId, mind, *interfaces):
     print "running requestAvatar"
     if IConchUser in interfaces:
          print "if statement"
          user = ConchUser()
          user.channelLookup['session'] = SimpleSession
          return IConchUser, user, nothing
     else:
          raise NotImplementedError("No supported interfaces found.")
開發者ID:nahommarie,項目名稱:UrbanFlows,代碼行數:11,代碼來源:sshserver3.py

示例3: requestAvatar

# 需要導入模塊: from twisted.conch.avatar import ConchUser [as 別名]
# 或者: from twisted.conch.avatar.ConchUser import channelLookup['session'] [as 別名]
 def requestAvatar(self, avatarId, mind, *interfaces):
     user = ConchUser()
     user.channelLookup['session'] = SimpleSession
     return IConchUser, user, nothing
開發者ID:mizzy,項目名稱:twisted-conch-example,代碼行數:6,代碼來源:ssh-server.py


注:本文中的twisted.conch.avatar.ConchUser.channelLookup['session']方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。