Exemplo n.º 1
0
async def get_configured_auth_service(name: str, **kwargs: Any) -> AsyncGenerator[BaseAuthService, None]:
    service_class = get_auth_service_class(name)
    config = make_config(kwargs, service_class.get_plugin_options())
    service = service_class(**config._unpack())  # pylint: disable=protected-access
    try:
        yield service
    finally:
        await service.cleanup()
Exemplo n.º 2
0
def _make_service_kwargs(path: str) -> Dict:
    cls = get_auth_service_class("htpasswd")
    scheme = cls.get_plugin_options()
    return make_config({"file": path}, scheme)._unpack()  # pylint: disable=protected-access