From 2eb906fae8e35e60a43b21bf31e39efaebde92c9 Mon Sep 17 00:00:00 2001 From: tanshu Date: Mon, 4 May 2020 16:54:38 +0530 Subject: [PATCH] Fix. .htpasswd did not take into account absolute paths --- bifrost/auth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bifrost/auth.py b/bifrost/auth.py index 29fff3b..9127747 100644 --- a/bifrost/auth.py +++ b/bifrost/auth.py @@ -2,7 +2,6 @@ import os from crypt import crypt from functools import lru_cache -import pkg_resources from fastapi import Depends, HTTPException, status from fastapi.security import HTTPBasic, HTTPBasicCredentials @@ -17,7 +16,8 @@ def get_settings(): def validate(username: str, password: str, settings: config.Settings): - file = pkg_resources.resource_filename("bifrost", "../" + settings.htpasswd) + here = os.path.abspath(os.path.dirname(__file__)) + file = os.path.join(here, '../', settings.htpasswd) if not os.path.isfile(file): return None users = {}