本文整理汇总了Python中oic.oic.consumer.Consumer.provider_config方法的典型用法代码示例。如果您正苦于以下问题:Python Consumer.provider_config方法的具体用法?Python Consumer.provider_config怎么用?Python Consumer.provider_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oic.oic.consumer.Consumer
的用法示例。
在下文中一共展示了Consumer.provider_config方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_provider_config
# 需要导入模块: from oic.oic.consumer import Consumer [as 别名]
# 或者: from oic.oic.consumer.Consumer import provider_config [as 别名]
def test_provider_config(self):
c = Consumer(None, None)
mfos = MyFakeOICServer("http://example.com")
mfos.keyjar = SRVKEYS
c.http_request = mfos.http_request
principal = "[email protected]"
res = c.discover(principal)
info = c.provider_config(res)
assert isinstance(info, ProviderConfigurationResponse)
assert _eq(info.keys(), ['registration_endpoint', 'jwks_uri',
'check_session_endpoint',
'refresh_session_endpoint',
'register_endpoint',
'subject_types_supported',
'token_endpoint_auth_methods_supported',
'id_token_signing_alg_values_supported',
'grant_types_supported', 'user_info_endpoint',
'claims_parameter_supported',
'request_parameter_supported',
'discovery_endpoint', 'issuer',
'authorization_endpoint', 'scopes_supported',
'require_request_uri_registration',
'identifiers_supported', 'token_endpoint',
'request_uri_parameter_supported', 'version',
'response_types_supported',
'end_session_endpoint', 'flows_supported'])
assert info["end_session_endpoint"] == "http://example.com/end_session"
示例2: init_oic
# 需要导入模块: from oic.oic.consumer import Consumer [as 别名]
# 或者: from oic.oic.consumer.Consumer import provider_config [as 别名]
def init_oic(self):
self.scopes = ["openid","profile","email"]
db = SessionStore(self.db)
client = Consumer(db, consumer_config, client_config=client_config)
client.allow['issuer_mismatch'] = True
client.provider_info = client.provider_config(self.provider)
providers = self.db.oic_registration.filter(None, {'issuer':self.provider})
assert len(providers) == 1
provider = self.db.oic_registration.getnode(providers[0])
client_reg = RegistrationResponse(client_id=provider['client_id'],
client_secret=provider['client_secret'])
client.store_registration_info(client_reg)
return client
示例3: test_client_register
# 需要导入模块: from oic.oic.consumer import Consumer [as 别名]
# 或者: from oic.oic.consumer.Consumer import provider_config [as 别名]
def test_client_register(self, fake_oic_server):
c = Consumer(None, None)
c.application_type = "web"
c.application_name = "My super service"
c.redirect_uris = ["https://example.com/authz"]
c.contact = ["[email protected]"]
mfos = fake_oic_server("https://example.com")
mfos.keyjar = SRVKEYS
c.http_request = mfos.http_request
location = c.discover("[email protected]")
info = c.provider_config(location)
c.register(info["registration_endpoint"])
assert c.client_id is not None
assert c.client_secret is not None
assert c.registration_expires > utc_time_sans_frac()
示例4: test_provider_config
# 需要导入模块: from oic.oic.consumer import Consumer [as 别名]
# 或者: from oic.oic.consumer.Consumer import provider_config [as 别名]
def test_provider_config():
c = Consumer(None, None)
mfos = MyFakeOICServer(SRVKEYS, "http://example.com/")
c.http_request = mfos.http_request
principal = "[email protected]"
res = c.discover(principal)
info = c.provider_config(res)
assert info.type() == "ProviderConfigurationResponse"
print info.keys()
assert _eq(info.keys(), ['registration_endpoint', 'check_session_endpoint',
'refresh_session_endpoint', 'scopes_supported',
'identifiers_supported', 'token_endpoint',
'version', 'user_info_endpoint',
'end_session_endpoint', 'authorization_endpoint',
'flows_supported', 'issuer'])
assert info["end_session_endpoint"] == "http://example.com/end_session"
示例5: test_provider_config
# 需要导入模块: from oic.oic.consumer import Consumer [as 别名]
# 或者: from oic.oic.consumer.Consumer import provider_config [as 别名]
def test_provider_config():
c = Consumer(None, None)
mfos = MyFakeOICServer("http://example.com")
mfos.keyjar = SRVKEYS
c.http_request = mfos.http_request
principal = "[email protected]"
res = c.discover(principal)
info = c.provider_config(res)
assert info.type() == "ProviderConfigurationResponse"
print info.keys()
assert _eq(info.keys(), ['registration_endpoint', u'check_session_endpoint',
u'refresh_session_endpoint', 'scopes_supported',
'subject_types_supported',
'token_endpoint_auth_methods_supported',
'id_token_signing_alg_values_supported',
u'flows_supported', 'version',
u'identifiers_supported', u'user_info_endpoint',
'response_types_supported', 'end_session_endpoint',
'authorization_endpoint', u'discovery_endpoint',
'token_endpoint', 'x509_url', 'issuer'])
assert info["end_session_endpoint"] == "http://example.com/end_session"
示例6: Consumer
# 需要导入模块: from oic.oic.consumer import Consumer [as 别名]
# 或者: from oic.oic.consumer.Consumer import provider_config [as 别名]
__author__ = 'rohe0002'
import sys
from oic.oic.consumer import Consumer
client = Consumer(None, None)
hosts = {"ebay":"https://openidconnect.ebay.com/",
"edmund":"https://connect.openid4.us/",
"gluu":"https://seed.gluu.org",
"herokuapp":"https://alloallo.herokuapp.com/",
"ibmau":"https://vhost0026.dc1.co.us.compute.ihost.com/",
"kodtest":"https://www.kodtest.se:8088/",
"orange":"http://pub-openid-int.orange.fr/",
"ryo":"https://openidconnect.info/",
"wenou":"https://wenou-test.wenoit.org/"}
attr = sys.argv[1]
for imp, host in hosts.items():
try:
pcr = client.provider_config(host)
except Exception:
print imp, "*failed*"
continue
try:
print imp, pcr[attr]
except KeyError:
print imp, "-"
示例7: Consumer
# 需要导入模块: from oic.oic.consumer import Consumer [as 别名]
# 或者: from oic.oic.consumer.Consumer import provider_config [as 别名]
#!/usr/bin/env python
__author__ = 'rohe0002'
import sys
from oic.oic.consumer import Consumer
principal = sys.argv[1]
if principal[0] in ["@", "=", "!"]:
print "Not supported"
sys.exit()
if "@" in principal:
idtype = "mail"
else:
idtype = "url"
client = Consumer(None, None)
issuer = client.discover(principal, idtype)
print "ISSUER: %s" % issuer
pcr = client.provider_config(issuer)
print pcr.to_dict()
示例8: KeyChain
# 需要导入模块: from oic.oic.consumer import Consumer [as 别名]
# 或者: from oic.oic.consumer.Consumer import provider_config [as 别名]
from oic.oic.consumer import Consumer
from oic.utils.keyio import KeyChain, KeyJar
__author__ = 'rohe0002'
from fakeoicsrv import MyFakeOICServer
CLIENT_SECRET = "abcdefghijklmnop"
CLIENT_ID = "client_1"
RSAPUB = "../oc3/certs/mycert.key"
KC_HMAC_VS = KeyChain({"hmac": CLIENT_SECRET}, usage=["ver", "sig"])
KC_RSA = KeyChain(source="file://%s" % RSAPUB, type="rsa", usage=["ver", "sig"])
KC_HMAC_S = KeyChain({"hmac": CLIENT_SECRET}, usage=["sig"])
SRVKEYS = KeyJar()
SRVKEYS[""] = [KC_RSA]
SRVKEYS["client_1"] = [KC_HMAC_VS, KC_RSA]
c = Consumer(None, None)
mfos = MyFakeOICServer("http://example.com")
mfos.keyjar = SRVKEYS
c.http_request = mfos.http_request
principal = "[email protected]"
res = c.discover(principal)
info = c.provider_config(res)
assert info.type() == "ProviderConfigurationResponse"