本文整理匯總了Python中oic.oauth2.Server.keyjar["foobar"]方法的典型用法代碼示例。如果您正苦於以下問題:Python Server.keyjar["foobar"]方法的具體用法?Python Server.keyjar["foobar"]怎麽用?Python Server.keyjar["foobar"]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類oic.oauth2.Server
的用法示例。
在下文中一共展示了Server.keyjar["foobar"]方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_server_parse_jwt_request
# 需要導入模塊: from oic.oauth2 import Server [as 別名]
# 或者: from oic.oauth2.Server import keyjar["foobar"] [as 別名]
def test_server_parse_jwt_request():
srv = Server()
ar = AuthorizationRequest(
response_type=["code"], client_id="foobar", redirect_uri="http://foobar.example.com/oaclient", state="cold"
)
srv.keyjar["foobar"] = KeyBundle({"hmac": "A1B2C3D4"}, usage=["ver", "sig"])
srv.keyjar[""] = KeyBundle({"hmac": "A1B2C3D4"}, usage=["ver", "sig"])
keys = srv.keyjar.get_signing_key(owner="foobar")
_jwt = ar.to_jwt(key=keys, algorithm="HS256")
req = srv.parse_jwt_request(txt=_jwt)
assert req.type() == "AuthorizationRequest"
assert req["response_type"] == ["code"]
assert req["client_id"] == "foobar"
assert req["redirect_uri"] == "http://foobar.example.com/oaclient"
assert req["state"] == "cold"