本文整理汇总了Python中jwkest.jwk.KEYS.load_from_url方法的典型用法代码示例。如果您正苦于以下问题:Python KEYS.load_from_url方法的具体用法?Python KEYS.load_from_url怎么用?Python KEYS.load_from_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jwkest.jwk.KEYS
的用法示例。
在下文中一共展示了KEYS.load_from_url方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_jwks_keys
# 需要导入模块: from jwkest.jwk import KEYS [as 别名]
# 或者: from jwkest.jwk.KEYS import load_from_url [as 别名]
def get_jwks_keys(self):
keys = KEYS()
keys.load_from_url(self.jwks_uri())
# Add client secret as oct key so it can be used for HMAC signatures
client_id, client_secret = self.get_key_and_secret()
keys.add({'key': client_secret, 'kty': 'oct'})
return keys
示例2: signing_keys
# 需要导入模块: from jwkest.jwk import KEYS [as 别名]
# 或者: from jwkest.jwk.KEYS import load_from_url [as 别名]
def signing_keys(self):
if self.signing_alg == self.RS256:
# TODO perform caching, OBVIOUS
key = KEYS()
key.load_from_url(self.jwks_uri)
rsa_key = key.as_dict()['RSA']
return rsa_key
return [SYMKey(key=str(self.client_secret))]
示例3: get_jwks_keys
# 需要导入模块: from jwkest.jwk import KEYS [as 别名]
# 或者: from jwkest.jwk.KEYS import load_from_url [as 别名]
def get_jwks_keys(self):
"""
Returns the keys used by the IdP.
Merges client secret into JWK set from server
Response is cached for 24 hours.
"""
keys = KEYS()
keys.load_from_url(self.JWKS_URI)
# Add client secret as oct key so it can be used for HMAC signatures
_client_id, client_secret = self.get_key_and_secret()
keys.add({'key': client_secret, 'kty': 'oct'})
return keys
示例4: _get_keys
# 需要导入模块: from jwkest.jwk import KEYS [as 别名]
# 或者: from jwkest.jwk.KEYS import load_from_url [as 别名]
def _get_keys(self):
if "jwk" in self:
return [self["jwk"]]
elif "jku" in self:
keys = KEYS()
keys.load_from_url(self["jku"])
return keys.as_dict()
elif "x5u" in self:
try:
return {"rsa": [load_x509_cert(self["x5u"], {})]}
except Exception:
# ca_chain = load_x509_cert_chain(self["x5u"])
pass
return {}
示例5: _get_keys
# 需要导入模块: from jwkest.jwk import KEYS [as 别名]
# 或者: from jwkest.jwk.KEYS import load_from_url [as 别名]
def _get_keys(self):
logger.debug("_get_keys(): self._dict.keys={0}".format(
self._dict.keys()))
if "jwk" in self:
return [self["jwk"]]
elif "jku" in self:
keys = KEYS()
keys.load_from_url(self["jku"])
return keys.as_dict()
elif "x5u" in self:
try:
return {"rsa": [load_x509_cert(self["x5u"], {})]}
except Exception:
# ca_chain = load_x509_cert_chain(self["x5u"])
pass
return {}
示例6: KEYS
# 需要导入模块: from jwkest.jwk import KEYS [as 别名]
# 或者: from jwkest.jwk.KEYS import load_from_url [as 别名]
kid=_kid))
if args.hmac_key:
keys.append(SYMKey(key=args.hmac_key))
if args.jwk:
kspec = json.loads(open(args.jwk).read())
keys.append(keyrep(kspec))
if args.jwks:
_k = KEYS()
_k.load_jwks(open(args.jwks).read())
keys.extend(_k._keys)
if args.jwks_url:
_k = KEYS()
_k.load_from_url(args.jwks_url, False)
keys.extend(_k._keys)
if not keys:
exit(-1)
if args.msg_file:
message = open(args.msg_file).read().strip("\n")
elif args.message == "-":
message = sys.stdin.read()
else:
message = args.message
if args.sign:
_msg = sign(message, keys, args.alg, args.msgtype)
if args.encrypt:
示例7: jwks
# 需要导入模块: from jwkest.jwk import KEYS [as 别名]
# 或者: from jwkest.jwk.KEYS import load_from_url [as 别名]
def jwks(self):
keys = KEYS()
keys.load_from_url(self.oidc_config['jwks_uri'])
return keys