本文整理汇总了Python中oic.oauth2.consumer.Consumer.client_secret方法的典型用法代码示例。如果您正苦于以下问题:Python Consumer.client_secret方法的具体用法?Python Consumer.client_secret怎么用?Python Consumer.client_secret使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oic.oauth2.consumer.Consumer
的用法示例。
在下文中一共展示了Consumer.client_secret方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_consumer_client_get_access_token_reques
# 需要导入模块: from oic.oauth2.consumer import Consumer [as 别名]
# 或者: from oic.oauth2.consumer.Consumer import client_secret [as 别名]
def test_consumer_client_get_access_token_reques():
_session_db = {}
cons = Consumer(_session_db, client_config=CLIENT_CONFIG,
server_info=SERVER_INFO, **CONSUMER_CONFIG)
cons.client_secret = "secret0"
_state = "state"
cons.redirect_uris = ["https://www.example.com/oic/cb"]
resp1 = AuthorizationResponse(code="auth_grant", state=_state)
cons.parse_response(AuthorizationResponse, resp1.to_urlencoded(),
"urlencoded")
resp2 = AccessTokenResponse(access_token="token1",
token_type="Bearer", expires_in=0,
state=_state)
cons.parse_response(AccessTokenResponse, resp2.to_urlencoded(),
"urlencoded")
url, body, http_args = cons.get_access_token_request(_state)
assert url == "http://localhost:8088/token"
print body
assert body == ("code=auth_grant&client_secret=secret0&"
"grant_type=authorization_code&client_id=number5&"
"redirect_uri=https%3A%2F%2Fwww.example.com%2Foic%2Fcb")
assert http_args == {'headers': {
'Content-type': 'application/x-www-form-urlencoded'}}
示例2: test_consumer_client_auth_info
# 需要导入模块: from oic.oauth2.consumer import Consumer [as 别名]
# 或者: from oic.oauth2.consumer.Consumer import client_secret [as 别名]
def test_consumer_client_auth_info():
_session_db = {}
cons = Consumer(_session_db, client_config=CLIENT_CONFIG,
server_info=SERVER_INFO, **CONSUMER_CONFIG)
cons.client_secret = "secret0"
ra, ha, extra = cons.client_auth_info()
assert ra == {'client_secret': 'secret0', 'client_id': 'number5'}
assert ha == {}
assert extra == {'auth_method': 'bearer_body'}
示例3: get_consumer
# 需要导入模块: from oic.oauth2.consumer import Consumer [as 别名]
# 或者: from oic.oauth2.consumer.Consumer import client_secret [as 别名]
def get_consumer(self):
"""
Creates a OAuth 2.0 consumer from a given configuration.
:param user_id_hash_type: Tells the OAuth consumer how to ask for user id. In oidc can
pairwise and public be used.
:type user_id_hash_type: UserIdHashType
:rtype: Consumer
:return: An OAuth 2.0 consumer.
"""
consumer = Consumer(
session_db=None,
client_config=self.config["client_config"],
server_info=self.config["server_info"],
authz_page=self.config["authz_page"],
response_type=self.config["response_type"])
consumer.client_secret = self.config["client_secret"]
return consumer
示例4: Consumer
# 需要导入模块: from oic.oauth2.consumer import Consumer [as 别名]
# 或者: from oic.oauth2.consumer.Consumer import client_secret [as 别名]
if args.conf_path:
sys.path.insert(0, args.conf_path)
RP_CONF = importlib.import_module(args.config)
# per AS instantiate a consumer
for name, info in RP_CONF.AS_CONF.items():
c_conf = {"client_id": info["client_id"]}
CONSUMER[name] = Consumer(
session_db={}, client_config=c_conf,
server_info={
"authorization_endpoint": info["authorization_endpoint"],
"token_endpoint": info["token_endpoint"]},
authz_page="authz_cb", response_type="code")
CONSUMER[name].client_secret = info["client_secret"]
SRV = wsgiserver.CherryPyWSGIServer(('0.0.0.0', RP_CONF.PORT),
SessionMiddleware(application,
session_opts))
if RP_CONF.BASE.startswith("https"):
from cherrypy.wsgiserver import ssl_pyopenssl
SRV.ssl_adapter = ssl_pyopenssl.pyOpenSSLAdapter(
RP_CONF.SERVER_CERT, RP_CONF.SERVER_KEY, RP_CONF.CA_BUNDLE)
LOGGER.info(START_MESG % (RP_CONF.PORT, RP_CONF.HOST))
print(START_MESG % (RP_CONF.PORT, RP_CONF.HOST))
try:
SRV.start()