コード例 #1
0
ファイル: test_client.py プロジェクト: zizhang-wish/pyoidc
    def test_pkce_verify_256(self, session_db_factory):
        _cli = Client(
            config={"code_challenge": {
                "method": "S256",
                "length": 64
            }})
        args, cv = _cli.add_code_challenge()

        authn_broker = AuthnBroker()
        authn_broker.add("UNDEFINED", DummyAuthn(None, "username"))
        _prov = Provider(
            "as",
            session_db_factory("https://connect-op.heroku.com"),
            {},
            authn_broker,
            Implicit(),
            verify_client,
        )

        assert _prov.verify_code_challenge(cv, args["code_challenge"]) is True
        assert _prov.verify_code_challenge(cv, args["code_challenge"],
                                           "S256") is True
        resp = _prov.verify_code_challenge("XXX", args["code_challenge"])
        assert isinstance(resp, Response)
        assert resp.info()["status_code"] == 401
コード例 #2
0
 def test_pkce_create(self):
     _cli = Client(
         config={'code_challenge': {
             'method': 'S256',
             'length': 64
         }})
     args, cv = _cli.add_code_challenge()
     assert args['code_challenge_method'] == 'S256'
     assert _eq(list(args.keys()),
                ['code_challenge_method', 'code_challenge'])
コード例 #3
0
ファイル: test_client.py プロジェクト: zizhang-wish/pyoidc
 def test_pkce_create(self):
     _cli = Client(
         config={"code_challenge": {
             "method": "S256",
             "length": 64
         }})
     args, cv = _cli.add_code_challenge()
     assert args["code_challenge_method"] == "S256"
     assert _eq(list(args.keys()),
                ["code_challenge_method", "code_challenge"])
コード例 #4
0
    def test_pkce_verify_512(self, session_db_factory):
        _cli = Client(config={'code_challenge': {'method': 'S512', 'length': 96}})
        args, cv = _cli.add_code_challenge()

        authn_broker = AuthnBroker()
        authn_broker.add("UNDEFINED", DummyAuthn(None, "username"))
        _prov = Provider("as",
                         session_db_factory('https://connect-op.heroku.com'), {},
                         authn_broker, Implicit(), verify_client)

        assert _prov.verify_code_challenge(cv, args['code_challenge'], 'S512') is True
        resp = _prov.verify_code_challenge('XXX', args['code_challenge'])
        assert isinstance(resp, Response)
        assert resp.info()['status_code'] == 401
コード例 #5
0
    def test_pkce_verify_512(self, session_db_factory):
        _cli = Client(config={'code_challenge': {'method': 'S512', 'length': 96}})
        args, cv = _cli.add_code_challenge()

        authn_broker = AuthnBroker()
        authn_broker.add("UNDEFINED", DummyAuthn(None, "username"))
        _prov = Provider("as",
                         session_db_factory('https://connect-op.heroku.com'), {},
                         authn_broker, Implicit(), verify_client)

        assert _prov.verify_code_challenge(cv, args['code_challenge'], 'S512') is True
        resp = _prov.verify_code_challenge('XXX', args['code_challenge'])
        assert isinstance(resp, Response)
        assert resp.info()['status_code'] == 401
コード例 #6
0
 def test_pkce_create(self):
     _cli = Client(config={'code_challenge': {'method': 'S256', 'length': 64}})
     args, cv = _cli.add_code_challenge()
     assert args['code_challenge_method'] == 'S256'
     assert _eq(list(args.keys()), ['code_challenge_method', 'code_challenge'])