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


Python webfinger.WebFinger类代码示例

本文整理汇总了Python中oic.utils.webfinger.WebFinger的典型用法代码示例。如果您正苦于以下问题:Python WebFinger类的具体用法?Python WebFinger怎么用?Python WebFinger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WebFinger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: discover

 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,代码行数:7,代码来源:testclass.py

示例2: setup_webfinger_endpoint

 def setup_webfinger_endpoint(self):
     wf = WebFinger()
     resp = Response(wf.response(subject=self.op_base, base=self.op_base))
     responses.add(responses.GET,
                   self.op_base + ".well-known/webfinger",
                   body=resp.message,
                   status=200,
                   content_type='application/json')
开发者ID:borgand,项目名称:SATOSA,代码行数:8,代码来源:FakeOp.py

示例3: _webfinger

def _webfinger(provider, request, **kwargs):
    """Handle webfinger requests."""
    params = urlparse.parse_qs(request)
    if params["rel"][0] == OIC_ISSUER:
        wf = WebFinger()
        return Response(wf.response(params["resource"][0], provider.baseurl),
                        headers=[("Content-Type", "application/jrd+json")])
    else:
        return BadRequest("Incorrect webfinger.")
开发者ID:ga4gh,项目名称:server,代码行数:9,代码来源:server.py

示例4: test_wf4

def test_wf4():
    wf = WebFinger()
    jrd0 = wf.load(json.dumps(EX0))

    print jrd0

    for link in jrd0["links"]:
        if link["rel"] == "blog":
            print link["href"]
            assert link["href"] == "http://blogs.example.com/bob/"
开发者ID:joestubbs,项目名称:pyoidc,代码行数:10,代码来源:test_webfinger.py

示例5: webfinger

def webfinger(environ):
    query = parse_qs(environ["QUERY_STRING"])
    try:
        assert query["rel"] == [OIC_ISSUER]
        resource = query["resource"][0]
    except KeyError:
        resp = BadRequest("Missing parameter in request")
    else:
        wf = WebFinger()
        resp = Response(wf.response(subject=resource, base=AUTHZSRV.baseurl))
    return resp
开发者ID:dv10den,项目名称:pyuma,代码行数:11,代码来源:as.py

示例6: _webfinger

 def _webfinger(self):
     query = request.args
     try:
         assert query["rel"] == OIC_ISSUER
         resource = query["resource"][0]
     except KeyError:
         resp = BadRequest("Missing parameter in request")
     else:
         wf = WebFinger()
         resp = Response(wf.response(subject=resource, base=self.provider.baseurl))
     return resp
开发者ID:its-dirg,项目名称:proof-of-possession,代码行数:11,代码来源:op_blueprint.py

示例7: find_srv_discovery_url

    def find_srv_discovery_url(self, resource):
        """
        Use Webfinger to find the OP, The input is a unique identifier
        of the user. Allowed forms are the acct, mail, http and https
        urls. If no protocol specification is given like if only an
        email like identifier is given. It will be translated if possible to
        one of the allowed formats.

        :param resource: unique identifier of the user.
        :return:
        """

        wf = WebFinger(httpd=PBase(ca_certs=self.extra["ca_bundle"]))
        return wf.discovery_query(resource)
开发者ID:dallerbarn,项目名称:pyoidc,代码行数:14,代码来源:oidc.py

示例8: __init__

    def __init__(self, client_id=None, ca_certs=None,
                 client_prefs=None, client_authn_method=None, keyjar=None):

        oauth2.Client.__init__(self, client_id, ca_certs,
                               client_authn_method=client_authn_method,
                               keyjar=keyjar)

        self.file_store = "./file/"
        self.file_uri = "http://localhost/"

        # OpenID connect specific endpoints
        for endpoint in ENDPOINTS:
            setattr(self, endpoint, "")

        self.id_token = None
        self.log = None

        self.request2endpoint = REQUEST2ENDPOINT
        self.response2error = RESPONSE2ERROR
        self.grant_class = Grant
        self.token_class = Token
        self.provider_info = {}
        self.client_prefs = client_prefs or {}
        self.behaviour = {"require_signed_request_object":
                          DEF_SIGN_ALG["openid_request_object"]}

        self.wf = WebFinger(OIC_ISSUER)
        self.wf.httpd = self
        self.allow = {}
        self.post_logout_redirect_uris = []
开发者ID:hdknr,项目名称:pyoidc,代码行数:30,代码来源:__init__.py

示例9: __init__

    def __init__(self, client_id=None, ca_certs=None, grant_expire_in=600,
                 jwt_keys=None, client_timeout=0, client_prefs=None):

        oauth2.Client.__init__(self, client_id, ca_certs, grant_expire_in,
                               client_timeout=client_timeout,
                               jwt_keys=jwt_keys)

        self.file_store = "./file/"
        self.file_uri = "http://localhost/"

        # OpenID connect specific endpoints
        for endpoint in ENDPOINTS:
            setattr(self, endpoint, "")

        self.id_token = None
        self.log = None

        self.request2endpoint = REQUEST2ENDPOINT
        self.response2error = RESPONSE2ERROR
        self.grant_class = Grant
        self.token_class = Token
        self.authn_method = AUTHN_METHOD
        self.provider_info = {}
        self.client_prefs = client_prefs or {}
        self.behaviour = {"require_signed_request_object":
                          DEF_SIGN_ALG["openid_request_object"]}

        self.wf = WebFinger(OIC_ISSUER)
        self.wf.httpd = self
开发者ID:asheidan,项目名称:pyoidc,代码行数:29,代码来源:__init__.py

示例10: webfinger

def webfinger(environ, start_response, session_info, trace, **kwargs):
    query = parse_qs(environ["QUERY_STRING"])

    # Find the identifier
    session_info["test_id"] = find_identifier(query["resource"][0])

    trace.info(HEADER % "WebFinger")
    trace.request(environ["QUERY_STRING"])
    trace.info("QUERY: %s" % (query,))

    try:
        assert query["rel"] == [OIC_ISSUER]
        resource = query["resource"][0]
    except AssertionError:
        errmsg = "Wrong 'rel' value: %s" % query["rel"][0]
        trace.error(errmsg)
        resp = BadRequest(errmsg)
    except KeyError:
        errmsg = "Missing 'rel' parameter in request"
        trace.error(errmsg)
        resp = BadRequest(errmsg)
    else:
        wf = WebFinger()
        p = urlparse(resource)

        if p.scheme == "acct":
            l, _ = p.path.split("@")
            path = pathmap.IDMAP[l.lower()]
        else:  # scheme == http/-s
            try:
                path = pathmap.IDMAP[p.path[1:].lower()]
            except KeyError:
                path = None

        if path:
            _url = os.path.join(kwargs["op_arg"]["baseurl"],
                                session_info["test_id"],
                                path[1:])
            resp = Response(wf.response(subject=resource, base=_url),
                            content="application/jrd+json")
        else:
            resp = BadRequest("Incorrect resource specification")

        trace.reply(resp.message)

    dump_log(session_info, trace)
    return resp(environ, start_response)
开发者ID:rohe,项目名称:otest,代码行数:47,代码来源:endpoints_n.py

示例11: __init__

 def __init__(self, name=""):
     Server.__init__(self)
     self.sdb = SessionDB()
     self.name = name
     self.client = {}
     self.registration_expires_in = 3600
     self.host = ""
     self.webfinger = WebFinger()
开发者ID:HaToHo,项目名称:pyoidc,代码行数:8,代码来源:fakeoicsrv.py

示例12: __init__

 def __init__(self, name=""):
     Server.__init__(self)
     self.sdb = SessionDB(name)
     self.name = name
     self.client = {}
     self.registration_expires_in = 3600
     self.host = ""
     self.webfinger = WebFinger()
     self.userinfo_signed_response_alg = ""
开发者ID:dallerbarn,项目名称:pyoidc,代码行数:9,代码来源:mitmsrv.py

示例13: test_wf4

    def test_wf4(self):
        EX0 = {
            "expires": "2012-11-16T19:41:35Z",
            "subject": "acct:[email protected]",
            "aliases": [
                "http://www.example.com/~bob/"
            ],
            "properties": {
                "http://example.com/ns/role/": "employee"
            },
            "links": [
                {
                    "rel": "http://webfinger.net/rel/avatar",
                    "type": "image/jpeg",
                    "href": "http://www.example.com/~bob/bob.jpg"
                },
                {
                    "rel": "http://webfinger.net/rel/profile-page",
                    "href": "http://www.example.com/~bob/"
                },
                {
                    "rel": "blog",
                    "type": "text/html",
                    "href": "http://blogs.example.com/bob/",
                    "titles": {
                        "en-us": "The Magical World of Bob",
                        "fr": "Le monde magique de Bob"
                    }
                },
                {
                    "rel": "vcard",
                    "href": "https://www.example.com/~bob/bob.vcf"
                }
            ]
        }

        wf = WebFinger()
        jrd0 = wf.load(json.dumps(EX0))

        for link in jrd0["links"]:
            if link["rel"] == "blog":
                assert link["href"] == "http://blogs.example.com/bob/"
                break
开发者ID:Omosofe,项目名称:pyoidc,代码行数:43,代码来源:test_webfinger.py

示例14: webfinger

def webfinger(environ, start_response, session_info, events, jlog, **kwargs):
    _query = session_info['parameters']
    events.store(EV_REQUEST, Operation("WebFinger", _query))

    try:
        assert _query["rel"] == [OIC_ISSUER]
        resource = _query["resource"][0]
    except AssertionError:
        errmsg = "Wrong 'rel' value: %s" % _query["rel"][0]
        events.store(EV_FAULT, errmsg)
        resp = BadRequest(errmsg)
    except KeyError:
        errmsg = "Missing 'rel' parameter in request"
        events.store(EV_FAULT, errmsg)
        resp = BadRequest(errmsg)
    else:
        wf = WebFinger()

        _url = os.path.join(kwargs["op_arg"]["baseurl"],
                            session_info['oper_id'],
                            session_info["test_id"])

        _mesg = wf.response(subject=resource, base=_url)
        if session_info['test_id'] == 'rp-discovery-webfinger-http-href':
            _msg = json.loads(_mesg)
            _msg['links'][0]['href'] = _msg['links'][0]['href'].replace(
                'https', 'http')
            _mesg = json.dumps(_msg)
        elif session_info['test_id'] == 'rp-discovery-webfinger-unknown-member':
            _msg = json.loads(_mesg)
            _msg['dummy'] = 'foobar'
            _mesg = json.dumps(_msg)

        resp = Response(_mesg,
                        content="application/jrd+json")

        events.store(EV_RESPONSE, resp.message)

    jlog.info(resp2json(resp))

    dump_log(session_info, events)
    return resp(environ, start_response)
开发者ID:selfissued,项目名称:oidctest,代码行数:42,代码来源:endpoints.py

示例15: webfinger

def webfinger(environ, start_response, session, trace):
    query = parse_qs(environ["QUERY_STRING"])

    # Find the identifier
    session["test_id"] = find_identifier(query["resource"][0])

    trace.info(HEADER % "WebFinger")
    trace.request(environ["QUERY_STRING"])
    trace.info("QUERY: %s" % (query,))

    try:
        assert query["rel"] == [OIC_ISSUER]
        resource = query["resource"][0]
    except AssertionError:
        errmsg = "Wrong 'rel' value: %s" % query["rel"][0]
        trace.error(errmsg)
        resp = BadRequest(errmsg)
    except KeyError:
        errmsg = "Missing 'rel' parameter in request"
        trace.error(errmsg)
        resp = BadRequest(errmsg)
    else:
        wf = WebFinger()
        p = urlparse(resource)
        if p.scheme == "acct":
            l, _ = p.path.split("@")
            path = pathmap.IDMAP[l]
        else:  # scheme == http/-s
            path = pathmap.IDMAP[p.path[1:]]

        _url = os.path.join(OP_ARG["baseurl"], session["test_id"], path[1:])
        resp = Response(wf.response(subject=resource, base=_url))

        trace.reply(resp.message)

    dump_log(session, trace)
    return resp(environ, start_response)
开发者ID:dv10den,项目名称:oidctest,代码行数:37,代码来源:server.py


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