本文整理汇总了Python中oic.utils.webfinger.WebFinger.query方法的典型用法代码示例。如果您正苦于以下问题:Python WebFinger.query方法的具体用法?Python WebFinger.query怎么用?Python WebFinger.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oic.utils.webfinger.WebFinger
的用法示例。
在下文中一共展示了WebFinger.query方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: discover
# 需要导入模块: from oic.utils.webfinger import WebFinger [as 别名]
# 或者: from oic.utils.webfinger.WebFinger import query [as 别名]
def discover(self, *arg, **kwargs):
wf = WebFinger(OIC_ISSUER)
wf.httpd = PBase()
_url = wf.query(kwargs["principal"])
self.trace.request("URL: %s" % _url)
url = wf.discovery_query(kwargs["principal"])
return url
示例2: test_query_acct
# 需要导入模块: from oic.utils.webfinger import WebFinger [as 别名]
# 或者: from oic.utils.webfinger.WebFinger import query [as 别名]
def test_query_acct(self):
wf = WebFinger(OIC_ISSUER)
query = wf.query("acct:[email protected]")
assert query == "https://example.com/.well-known/webfinger?resource=acct%3Acarol%40example.com&rel=http%3A%2F%2Fopenid.net%2Fspecs%2Fconnect%2F1.0%2Fissuer"
示例3: test_query_rel
# 需要导入模块: from oic.utils.webfinger import WebFinger [as 别名]
# 或者: from oic.utils.webfinger.WebFinger import query [as 别名]
def test_query_rel(self):
wf = WebFinger()
query = wf.query("acct:[email protected]",
["http://webfinger.net/rel/profile-page", "vcard"])
assert query == "https://example.com/.well-known/webfinger?resource=acct%3Abob%40example.com&rel=http%3A%2F%2Fwebfinger.net%2Frel%2Fprofile-page&rel=vcard"
示例4: test_query_device
# 需要导入模块: from oic.utils.webfinger import WebFinger [as 别名]
# 或者: from oic.utils.webfinger.WebFinger import query [as 别名]
def test_query_device(self):
wf = WebFinger()
query = wf.query(resource="device:p1.example.com")
assert query == 'https://p1.example.com/.well-known/webfinger?resource=device%3Ap1.example.com'
示例5: WebFinger
# 需要导入模块: from oic.utils.webfinger import WebFinger [as 别名]
# 或者: from oic.utils.webfinger.WebFinger import query [as 别名]
#
# HTTP/1.1 200 OK
# Access-Control-Allow-Origin *
# Content-Type: application/jrd+json
#
# {
# "subject" : "acct:[email protected]",
# "links":
# [{
# "rel": "http://openid.net/specs/connect/1.0/issuer",
# "href": "https://openid.example.com"
# }]
# }
userid = "[email protected]"
wf = WebFinger()
query = wf.query("acct:%s" % userid, rel=OIC_ISSUER)
print query
r = requests.request("GET", query, verify=False)
jwt = json.loads(r.text)
print json.dumps(jwt, sort_keys=True, indent=4, separators=(',', ': '))
print
#########################################################
wf = WebFinger()
wf.httpd = PBase(verify_ssl=False)
url = wf.discovery_query("acct:%s" % userid)
print "The user should be redirected here for login", url
示例6: WebFinger
# 需要导入模块: from oic.utils.webfinger import WebFinger [as 别名]
# 或者: from oic.utils.webfinger.WebFinger import query [as 别名]
"""
import json
from oic.oauth2 import PBase
import requests
from oic.utils.webfinger import WebFinger, OIC_ISSUER
__author__ = 'roland'
# =====================================================================
# Using only very basic functions and methods
# Initiate the WebFinger class
wf = WebFinger()
# contruct the webfinger query URL
query = wf.query("acct:[email protected]", rel=OIC_ISSUER)
print(query)
r = requests.request("GET", query, verify=False)
# parse the JSON returned by the website and dump the content to
# standard out
jwt = json.loads(r.text)
print(json.dumps(jwt, sort_keys=True, indent=4, separators=(',', ': ')))
# =====================================================================
# A bit more high level
wf = WebFinger()
示例7: WebFinger
# 需要导入模块: from oic.utils.webfinger import WebFinger [as 别名]
# 或者: from oic.utils.webfinger.WebFinger import query [as 别名]
Shows off how you can do OpenID Connect dynamic configuration discovery
"""
import json
import requests
from oic.oic import Client
from oic.oic import OIDCONF_PATTERN
from oic.utils.webfinger import WebFinger
from oic.utils.webfinger import OIC_ISSUER
__author__ = 'roland'
# =============================================================================
wf = WebFinger()
query = wf.query("acct:[email protected]:8060", rel=OIC_ISSUER)
r = requests.request("GET", query, verify=False)
jwt = json.loads(r.text)
url = jwt["links"][0]["href"]
print("Provider:", url)
# Construct the URL used to get the provider configuration
url = OIDCONF_PATTERN % url[:-1]
print("Provider info url:", url)
r = requests.request("GET", url, verify=False)