当前位置: 首页>>代码示例>>Python>>正文


Python WebFinger.query方法代码示例

本文整理汇总了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
开发者ID:dallerbarn,项目名称:oictest,代码行数:9,代码来源:testclass.py

示例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"
开发者ID:Omosofe,项目名称:pyoidc,代码行数:7,代码来源:test_webfinger.py

示例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"
开发者ID:Omosofe,项目名称:pyoidc,代码行数:7,代码来源:test_webfinger.py

示例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'
开发者ID:Omosofe,项目名称:pyoidc,代码行数:6,代码来源:test_webfinger.py

示例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
开发者ID:biancini,项目名称:ojou_course,代码行数:33,代码来源:oidc_webfinger.py

示例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()
开发者ID:biancini,项目名称:ojou_course,代码行数:32,代码来源:webfinger.py

示例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)
开发者ID:biancini,项目名称:ojou_course,代码行数:32,代码来源:discover.py


注:本文中的oic.utils.webfinger.WebFinger.query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。