def export(self, client, cconf, role): # has to be there self.trace.info("EXPORT") if client.keyjar is None: client.keyjar = KeyJar() kbl = [] for typ, info in cconf["keys"].items(): kb = KeyBundle(source="file://%s" % info["key"], fileformat="der", keytype=typ) for k in kb.keys(): k.serialize() client.keyjar.add_kb("", kb) kbl.append(kb) try: new_name = "static/%s_jwks.json" % role dump_jwks(kbl, new_name) client.jwks_uri = "%s%s" % (cconf["_base_url"], new_name) except KeyError: pass if not self.args.external_server and not self.keysrv_running: self._pop = start_key_server(cconf["_base_url"]) self.environ["keyprovider"] = self._pop self.trace.info("Started key provider") time.sleep(1) self.keysrv_running = True
def __call__(self, environ, trace, location, response, content, features): _client = environ["client"] part, res = _client.keystore.key_export(self.export_server, **KEY_EXPORT_ARGS) # Do the redirect_uris dynamically self.request_args["redirect_uris"] = _client.redirect_uris for name, url in res.items(): self.request_args[name] = url if "keyprovider" not in environ: _pop = start_key_server(part) environ["keyprovider"] = _pop trace.info("Started key provider") time.sleep(1) return PostRequest.__call__(self, environ, trace, location, response, content, features)
def __init__(self, environ=None, start_response=None, session=None, logger=None, lookup=None, config=None, parameters=None, cache=None): """ Constructor for the class. :param environ: WSGI enviroment :param start_response: WSGI start_respose :param session: Beaker session :param logger: Class to perform logging. """ #Sets the parameters to a default value in order to make i more testable self.environ = environ self.start_response = start_response self.session = session self.logger = logger self.lookup = lookup self.config = config self.parameters = parameters self.urls = { #Calles made from test OP page "test_op" : "test_op.mako", "list_tests" : None, "run_test" : None, "post_final_interaction_data" : None, "post_basic_interaction_data" : None, "reset_interaction" : None, "post_error_report": None, #Calles made from Configure OP page "op_config" : "op_config.mako", "download_config_file" : None, "upload_config_file" : None, "create_new_config_file": None, "does_config_file_exist": None, "get_op_config": None, "post_op_config": None, "validate_cookies": None, "" : "op_config.mako", "info" : "info.mako", } self.cache = cache self.key_provider = start_key_server(self.config.STATIC_PROVIDER_URL, self.config.STATIC_PROVIDER_SCRIPT_DIR)
def run_key_server(server_url, host, script_path="", wdir=""): kj = KeyJar() _ = key_export(server_url % host, keyjar=kj, **KEY_EXPORT_ARGS) return start_key_server(server_url % host, wdir, script_path)
def run_key_server(server_url_pattern, host): kj = KeyJar() part, res = key_export(server_url_pattern % host, keyjar=kj, **KEY_EXPORT_ARGS) return start_key_server(part)
def run_key_server(server_url_pattern, host): ks = KeyStore(None) part, res = ks.key_export(server_url_pattern % host, **KEY_EXPORT_ARGS) return start_key_server(part)
def run_key_server(server_url, host): kj = KeyJar() _ = key_export(server_url % host, keyjar=kj, **KEY_EXPORT_ARGS) return start_key_server(server_url)