Fix provider access
This commit is contained in:
parent
1407fe3d11
commit
d3cbca3571
@ -2,12 +2,12 @@ import ProxyAuthProvider from "./proxy";
|
||||
import NullAuthProvider from "./null";
|
||||
|
||||
const AuthProviders = {
|
||||
NullAuthProvider,
|
||||
ProxyAuthProvider,
|
||||
null: NullAuthProvider,
|
||||
proxy: ProxyAuthProvider,
|
||||
};
|
||||
|
||||
function getProviderByKey(key) {
|
||||
return AuthProviders.find((provider) => provider.key === key) ?? NullAuthProvider;
|
||||
return AuthProviders[key] || NullAuthProvider;
|
||||
}
|
||||
|
||||
function authAllow({ user, groups }, item) {
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
const NullPermissions = { user: null, groups: [] };
|
||||
const NullAuthKey = "none";
|
||||
|
||||
function createNullAuth() {
|
||||
return {
|
||||
@ -15,7 +14,6 @@ async function fetchNullAuth([key]) {
|
||||
}
|
||||
|
||||
const NullAuthProvider = {
|
||||
key: NullAuthKey,
|
||||
create: createNullAuth,
|
||||
fetch: fetchNullAuth,
|
||||
};
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
// 'proxy' auth provider is meant to be used by a reverse proxy that injects permission headers into the origin
|
||||
// request. In this case we are relying on our proxy to authenitcate our users and validate.
|
||||
const ProxyAuthKey = "proxy";
|
||||
|
||||
function getProxyPermissions(userHeader, groupHeader, request) {
|
||||
const user = userHeader ? request.headers.get(userHeader) : null;
|
||||
const groupsString = groupHeader ? request.headers.get(groupHeader) : "";
|
||||
@ -25,7 +23,6 @@ async function fetchProxyAuth([key, context]) {
|
||||
}
|
||||
|
||||
const ProxyAuthProvider = {
|
||||
key: ProxyAuthKey,
|
||||
create: createProxyAuth,
|
||||
fetch: fetchProxyAuth,
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user