• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python strcred.makeChecker函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中twisted.cred.strcred.makeChecker函数的典型用法代码示例。如果您正苦于以下问题:Python makeChecker函数的具体用法?Python makeChecker怎么用?Python makeChecker使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_warnWithBadFilename

 def test_warnWithBadFilename(self):
     """
     When the file auth plugin is given a file that doesn't exist, it
     should produce a warning.
     """
     oldOutput = cred_file.theFileCheckerFactory.errorOutput
     newOutput = StringIO.StringIO()
     cred_file.theFileCheckerFactory.errorOutput = newOutput
     strcred.makeChecker('file:' + self._fakeFilename())
     cred_file.theFileCheckerFactory.errorOutput = oldOutput
     self.assertIn(cred_file.invalidFileWarning, newOutput.getvalue())
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:11,代码来源:test_strcred.py


示例2: get_www

def get_www():
    from buildbot.plugins import util
    from twisted.cred import strcred
    import private

    return dict(
        port = "unix:/home/buildbot/buildbot.sock",
        plugins = dict(
            waterfall_view = {},
            console_view = {},
            grid_view = {},
            badges = {}
        ),
        auth = util.GitHubAuth(
            private.github_client_id,
            private.github_client_secret,
            apiVersion = 4,
            getTeamsMembership = True
        ),
        authz = util.Authz(
            allowRules = [
                util.AnyControlEndpointMatcher(role = "SFML")
            ],
            roleMatchers = [
                util.RolesFromGroups()
            ]
        ),
        change_hook_dialects = {'base': True, 'github' : {}},
        change_hook_auth = [strcred.makeChecker("file:changehook.passwd")]
    )
开发者ID:binary1248,项目名称:SFML-Buildbot,代码行数:30,代码来源:status.py


示例3: setUp

 def setUp(self):
     self.admin = credentials.UsernamePassword('admin', 'asdf')
     self.alice = credentials.UsernamePassword('alice', 'foo')
     self.badPass = credentials.UsernamePassword('alice', 'foobar')
     self.badUser = credentials.UsernamePassword('x', 'yz')
     self.filename = self.mktemp()
     FilePath(self.filename).setContent('admin:asdf\nalice:foo\n')
     self.checker = strcred.makeChecker('file:' + self.filename)
开发者ID:ali-hallaji,项目名称:twisted,代码行数:8,代码来源:test_strcred.py


示例4: test_isChecker

 def test_isChecker(self):
     """
     Verifies that strcred.makeChecker('anonymous') returns an object
     that implements the L{ICredentialsChecker} interface.
     """
     checker = strcred.makeChecker('anonymous')
     self.assertTrue(checkers.ICredentialsChecker.providedBy(checker))
     self.assertIn(credentials.IAnonymous, checker.credentialInterfaces)
开发者ID:ali-hallaji,项目名称:twisted,代码行数:8,代码来源:test_strcred.py


示例5: makeService

    def makeService(self, options):
        with open(options.config, "r") as config_file:
            config = json.load(config_file)

        root = resource.Resource()
        root.putChild('jsMath', static.File(config["global"]["jsmath"]))

        bot = service.MultiService()
        xmppclient = XMPPClient(JID(config["global"]["jid"]),
                                config["global"]["password"])
        xmppclient.logTraffic = options['verbose']
        xmppclient.setServiceParent(bot)
        xmppclient.dbpool = DatabaseRunner(config["global"]["database"])
        xmppclient.rooms = dict()

        xmlrpc_port = config["global"].get("xml-rpc-port", None)
        if xmlrpc_port is not None:
            xmlrpcinterface = XMLRPCInterface(xmppclient)
            rpc = internet.TCPServer(xmlrpc_port, server.Site(xmlrpcinterface))
            rpc.setName('XML-RPC')
            rpc.setServiceParent(bot)

        for muc_config in config["mucs"]:
            room_jid = JID(muc_config["jid"])
            mucbot = KITBot(room_jid, muc_config.get("password", None),
                            config["global"]["logpath"])
            mucbot.setHandlerParent(xmppclient)

            if "xml-rpc-id" in muc_config:
                xmppclient.rooms[muc_config["xml-rpc-id"]] = mucbot

            # Log resource
            portal = Portal(
                LogViewRealm(os.path.join(config["global"]['logpath'],
                                          room_jid.user + '.log')),
                [strcred.makeChecker(muc_config["log-auth"])]
            )
            credential_factory = DigestCredentialFactory('md5', 'Hello Kitty!')
            auth_resource = HTTPAuthSessionWrapper(portal, [credential_factory])
            root.putChild(room_jid.user, auth_resource)

        httpd_log_view = internet.TCPServer(config["global"]["http-port"],
                                            server.Site(root))
        httpd_log_view.setServiceParent(bot)

        # REPL over SSH
        def makeREPLProtocol():
            namespace = dict(bot=xmppclient)
            return insults.ServerProtocol(manhole.ColoredManhole, namespace)
        repl_realm = manhole_ssh.TerminalRealm()
        repl_realm.chainedProtocolFactory = makeREPLProtocol
        repl_checker = checkers.SSHPublicKeyDatabase()
        repl_portal = Portal(repl_realm, [repl_checker])
        repl_factory = manhole_ssh.ConchFactory(repl_portal)
        repl = internet.TCPServer(config["global"]["ssh-port"], repl_factory)
        repl.setServiceParent(bot)

        return bot
开发者ID:lorenzhs,项目名称:kitbot,代码行数:58,代码来源:kitbot_plugin.py


示例6: testAnonymousAccessSucceeds

 def testAnonymousAccessSucceeds(self):
     """
     Test that we can log in anonymously using this checker.
     """
     checker = strcred.makeChecker('anonymous')
     request = checker.requestAvatarId(credentials.Anonymous())
     def _gotAvatar(avatar):
         self.assertIdentical(checkers.ANONYMOUS, avatar)
     return request.addCallback(_gotAvatar)
开发者ID:ali-hallaji,项目名称:twisted,代码行数:9,代码来源:test_strcred.py


示例7: setUp

 def setUp(self):
     self.admin = credentials.UsernamePassword('admin', 'asdf')
     self.alice = credentials.UsernamePassword('alice', 'foo')
     self.badPass = credentials.UsernamePassword('alice', 'foobar')
     self.badUser = credentials.UsernamePassword('x', 'yz')
     self.checker = strcred.makeChecker('unix')
     # Hack around the pwd and spwd modules, since we can't really
     # go about reading your /etc/passwd or /etc/shadow files
     if pwd:
         self._pwd_getpwnam = pwd.getpwnam
         pwd.getpwnam = self._pwd
     if spwd:
         self._spwd_getspnam = spwd.getspnam
         spwd.getspnam = self._spwd
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:14,代码来源:test_strcred.py


示例8: test_setupSiteWithHookAndAuth

    def test_setupSiteWithHookAndAuth(self):
        fn = self.mktemp()
        with open(fn, 'w') as f:
            f.write("user:pass")
        new_config = self.makeConfig(
            port=8080,
            plugins={},
            change_hook_dialects={'base': True},
            change_hook_auth=[strcred.makeChecker("file:" + fn)])
        self.svc.setupSite(new_config)

        yield self.svc.reconfigServiceWithBuildbotConfig(new_config)
        rsrc = self.svc.site.resource.getChildWithDefault('', mock.Mock())

        res = yield self.render_resource(rsrc, '')
        self.assertIn('{"type": "file"}', res)

        rsrc = self.svc.site.resource.getChildWithDefault('change_hook', mock.Mock())
        res = yield self.render_resource(rsrc, '/change_hook/base')
        # as UnauthorizedResource is in private namespace, we cannot use assertIsInstance :-(
        self.assertIn('UnauthorizedResource', repr(res))
开发者ID:dinatale2,项目名称:buildbot,代码行数:21,代码来源:test_www_service.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python task.cooperate函数代码示例发布时间:2022-05-27
下一篇:
Python common.unquote_user_host函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap