def main(base_url, cookie_handler): config = { "registration_info": { "token_endpoint_auth_method": "client_secret_basic", "application_type": "web", "redirect_uris": ["%s/uma" % base_url], "grant_types": ["authorization_code", "implicit"], "scope": [PAT], "response_types": ["code", "token"] }, "client_authn_method": { "client_secret_basic": ClientSecretBasic, "bearer_header": BearerHeader }, "flow_type": "code", "symkey": "abcdefghijklmnop", "baseurl": base_url, "scope": PAT } dataset = RESTIDMWrap(USERDB, baseurl=config["baseurl"]) res_srv = ResourceServer1C(dataset, **config) jwks = keyjar_init(res_srv, KEYS, "a%d") fp = open("static/jwk_rs.json", "w") fp.write(json.dumps(jwks)) fp.close() cookie_handler.init_srv(res_srv) return res_srv
def __init__( self, dataset, symkey="", rs_keyjar=None, baseurl="", # client conf below client_id=None, ca_certs=None, client_authn_method=None, c_keyjar=None, server_info=None, authz_page="", flow_type="", password=None, registration_info=None, response_type="", scope="", ca_bundle=None): self.ressrv = ResourceServer1C.__init__(dataset, symkey, client_id, ca_certs, client_authn_method, rs_keyjar, server_info, authz_page, flow_type, password, registration_info, response_type, scope, baseurl) self.client = Client(client_id, ca_certs, client_authn_method, c_keyjar, server_info, authz_page, flow_type, password, registration_info, response_type, scope) self.ca_bundle = ca_bundle
def __init__( self, dataset, symkey="", rs_keyjar=None, baseurl="", # client conf below client_id=None, ca_certs=None, client_authn_method=None, c_keyjar=None, server_info=None, authz_page="", flow_type="", password=None, registration_info=None, response_type="", scope="", ca_bundle=None, ): self.ressrv = ResourceServer1C.__init__( dataset, symkey, client_id, ca_certs, client_authn_method, rs_keyjar, server_info, authz_page, flow_type, password, registration_info, response_type, scope, baseurl, ) self.authzsrv = OAuth2UmaAS( name, sdb, cdb, authn_broker, authz, client_authn, symkey, urlmap, as_keyjar, configuration=as_configuration, base_url=base_url, client_authn_methods=client_authn_methods, authn_at_registration=authn_at_registration, client_info_url=client_info_url, secret_lifetime=secret_lifetime, )
def __init__( self, dataset, symkey="", rs_keyjar=None, baseurl="", # client conf below client_id=None, ca_certs=None, client_authn_method=None, c_keyjar=None, server_info=None, authz_page="", flow_type="", password=None, registration_info=None, response_type="", scope="", ca_bundle=None, ): self.ressrv = ResourceServer1C.__init__( dataset, symkey, client_id, ca_certs, client_authn_method, rs_keyjar, server_info, authz_page, flow_type, password, registration_info, response_type, scope, baseurl, ) self.client = Client( client_id, ca_certs, client_authn_method, c_keyjar, server_info, authz_page, flow_type, password, registration_info, response_type, scope, ) self.ca_bundle = ca_bundle
def __init__( self, dataset, symkey="", rs_keyjar=None, baseurl="", # client conf below client_id=None, ca_certs=None, client_authn_method=None, c_keyjar=None, server_info=None, authz_page="", flow_type="", password=None, registration_info=None, response_type="", scope="", ca_bundle=None): self.ressrv = ResourceServer1C.__init__(dataset, symkey, client_id, ca_certs, client_authn_method, rs_keyjar, server_info, authz_page, flow_type, password, registration_info, response_type, scope, baseurl) self.authzsrv = OAuth2UmaAS( name, sdb, cdb, authn_broker, authz, client_authn, symkey, urlmap, as_keyjar, configuration=as_configuration, base_url=base_url, client_authn_methods=client_authn_methods, authn_at_registration=authn_at_registration, client_info_url=client_info_url, secret_lifetime=secret_lifetime)
def create_wrap(self): dataset = RESTIDMWrap(USERDB, baseurl='https://rest_idm.example.com') res_srv = ResourceServer1C(dataset, **CONFIG)
} CCONF = {"client_authn_method": CLIENT_AUTHN_METHOD} idp_client = Client({}, CCONF, registration_info=reginfo) # The UMA RS class DataSet(object): def __init__(self): pass def __call__(self, owner, scopes, **kwargs): return "Some result" ressrv = ResourceServer1C(DataSet(), registration_info=reginfo) EPPN = b"*****@*****.**" # A RS client md = hashlib.md5() md.update(EPPN) _key = base64.b16encode(md.digest()) reginfo = { "client_name": "https://rs.example.com", "application_type": "web", "redirect_uris": ["https://rs.example.com/uma/client/%s" % _key] } BASE = "http://localhost:8088"