raise ConfigNotRecognized( composite_key, 'This legacy resolver ' 'description is not supported anymore.') # ------------------------------------------------------------------------ - attr_name = parts[2] attr_updates[attr_name] = value object_id = parts[3] # the resolver name # ------------------------------------------------------------------------ - return object_id, attr_updates ConfigTree.add_parser('resolvers', parse_resolver) # -------------------------------------------------------------------------- -- __all__ = [ 'defineResolver', 'parse_resolver_spec', 'getResolverList', 'getResolverInfo', 'deleteResolver', 'getResolverObject', 'initResolvers', 'closeResolvers', 'setupResolvers' ] # -------------------------------------------------------------------------- -- # for the the resolver name check we use a reqular expression resolver_name_pattern = re.compile('^[a-zA-Z0-9_\-]{4,}$')
# ---------------------------------------------------------------------- -- return value, {'default': True} # -------------------------------------------------------------------------- -- # integrate the provider config parser into the config tree class for provider_type in Provider_types: parser_target = '%s_providers' % provider_type func = partial(parse_provider, provider_type) ConfigTree.add_parser(parser_target, func) default_func = partial(parse_default_provider, provider_type) ConfigTree.add_parser(parser_target, default_func) # XXX LEGACY if provider_type in Legacy_Provider: func = partial(parse_legacy_provider, provider_type) ConfigTree.add_parser(parser_target, func) # ---------------------------------------------------------------------------- - def get_legacy_provider(provider_type): """
return object_id, {'resolvers': value} def parse_default_realm(composite_key, value): """ Sets the attribute pair {default: True} to the default realm in the tree. """ if composite_key != 'linotp.DefaultRealm': raise ConfigNotRecognized(composite_key) return value, {'default': True} ConfigTree.add_parser('realms', parse_realm) ConfigTree.add_parser('realms', parse_default_realm) # ------------------------------------------------------------------------------ def createDBRealm(realm): ''' Store Realm in the DB Realm Table. If the realm already exist, we do not need to store it :param realm: the realm name :type realm: string :return : if realm is created(True) or already esists(False) :rtype : boolean
if len(parts) < 3: raise ConfigNotRecognized(composite_key, 'This legacy resolver ' 'description is not supported anymore.') # ------------------------------------------------------------------------ - attr_name = parts[2] attr_updates[attr_name] = value object_id = parts[3] # the resolver name # ------------------------------------------------------------------------ - return object_id, attr_updates ConfigTree.add_parser('resolvers', parse_resolver) # -------------------------------------------------------------------------- -- __all__ = ['defineResolver', 'parse_resolver_spec', 'getResolverList', 'getResolverInfo', 'deleteResolver', 'getResolverObject', 'initResolvers', 'closeResolvers', 'setupResolvers'] # -------------------------------------------------------------------------- -- # for the the resolver name check we use a reqular expression resolver_name_pattern = re.compile('^[a-zA-Z0-9_\-]{4,}$')
composite_key, "This legacy resolver description is not supported anymore.", ) # ------------------------------------------------------------------------ - attr_name = parts[2] attr_updates[attr_name] = value object_id = parts[3] # the resolver name # ------------------------------------------------------------------------ - return object_id, attr_updates ConfigTree.add_parser("resolvers", parse_resolver) # -------------------------------------------------------------------------- -- __all__ = [ "defineResolver", "parse_resolver_spec", "getResolverList", "getResolverInfo", "deleteResolver", "getResolverObject", "initResolvers", "closeResolvers", "setupResolvers", ]
raise ConfigNotRecognized(composite_key) # ---------------------------------------------------------------------- -- return value, {'default': True} # -------------------------------------------------------------------------- -- # integrate the provider config parser into the config tree class for provider_type in Provider_types: parser_target = '%s_providers' % provider_type func = partial(parse_provider, provider_type) ConfigTree.add_parser(parser_target, func) default_func = partial(parse_default_provider, provider_type) ConfigTree.add_parser(parser_target, default_func) # XXX LEGACY if provider_type in Legacy_Provider: func = partial(parse_legacy_provider, provider_type) ConfigTree.add_parser(parser_target, func) # ---------------------------------------------------------------------------- - def get_legacy_provider(provider_type): """
return object_id, {"resolvers": value} def parse_default_realm(composite_key, value): """ Sets the attribute pair {default: True} to the default realm in the tree. """ if composite_key != "linotp.DefaultRealm": raise ConfigNotRecognized(composite_key) return value, {"default": True} ConfigTree.add_parser("realms", parse_realm) ConfigTree.add_parser("realms", parse_default_realm) # ------------------------------------------------------------------------------ def createDBRealm(realm): """ Store Realm in the DB Realm Table. If the realm already exist, we do not need to store it :param realm: the realm name :type realm: string :return : if realm is created(True) or already esists(False) :rtype : boolean