diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..59514a1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,4 @@ +[build-system] +requires = ["setuptools>=61", "wheel"] +build-backend = "setuptools.build_meta" + diff --git a/rbac/check_perm.py b/rbac/check_perm.py index e28a384..c0d9ab0 100644 --- a/rbac/check_perm.py +++ b/rbac/check_perm.py @@ -125,6 +125,8 @@ async def bearer_auth(sor, auth): async def getAuthenticationUserid(sor, request): auth = request.headers.get('Authentication') + if auth is None: + return None for h,f in registered_auth_methods.items(): if auth.startswith(h): return await f(auth) @@ -168,6 +170,7 @@ registered_auth_methods = { "Basic ": basic_auth, "Bearer ": bearer_auth } -register_auth_method(heading, func): + +def register_auth_method(heading, func): registered_auth_methods[heading] = func diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..db6fe8b --- /dev/null +++ b/setup.cfg @@ -0,0 +1,16 @@ +[metadata] +name=rbac +version = 1.0.0 +description = a RBAC user authenticate module +author = "yu moqing" +author_email = "yumoqing@gmail.com" +readme = "README.md" +license = "MIT" +[options] +packages = find: +requires_python = ">=3.8" +install_requires = + apppublic + sqlor + ahserver +