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
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: """ try: wf = WebFinger(httpd=PBase(ca_certs=self.extra["ca_bundle"])) except KeyError: wf = WebFinger(httpd=PBase(verify_ssl=False)) return wf.discovery_query(resource)
def main(x509_file, out="keys.jwk"): pb = PBase() ks = KeyStore(pb.http_request) key = x509_rsa_loads(open(x509_file).read()) ks.add_key(key, "rsa", "sig") f = open(out, "w") txt = ks.dumps("sig") f.write(txt) f.close()
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: """ if self.ca_bundle: args = {"ca_certs": self.ca_bundle} else: args = {} wf = WebFinger(httpd=PBase(**args)) self.ressrv.srv_discovery_url = wf.discovery_query(resource)
#!/usr/bin/env python from oic.oauth2 import PBase from oic.oic import Client from oic.utils.webfinger import WebFinger __author__ = 'roland' import argparse parser = argparse.ArgumentParser() parser.add_argument('-w', dest='webfinger') parser.add_argument('-p', dest='providerinfo') cargs = parser.parse_args() issuer = "" if cargs.webfinger: _httpd = PBase(verify_ssl=False) w = WebFinger(httpd=_httpd) issuer = w.discovery_query(cargs.webfinger) print issuer if cargs.providerinfo: cli = Client(verify_ssl=False) if cargs.providerinfo != "-": issuer = cargs.providerinfo cli.provider_config(issuer) print cli.provider_info
import sys from oic.oauth2 import PBase from oic.utils.webfinger import WebFinger, OIC_ISSUER __author__ = 'roland' wf = WebFinger(OIC_ISSUER) wf.httpd = PBase() print(wf.discovery_query(sys.argv[1]))