Fixed api header authorization (#6399)

This commit is contained in:
SamTV12345 2024-05-22 21:16:19 +02:00 committed by GitHub
parent 8cd2ed07ba
commit 63e9b2d4eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4848 additions and 3834 deletions

File diff suppressed because it is too large Load diff

View file

@ -153,6 +153,7 @@ type APIFields = {
api_key: string; api_key: string;
padID: string; padID: string;
padName: string; padName: string;
authorization: string;
} }
/** /**
@ -179,7 +180,7 @@ exports.handle = async function (apiVersion: string, functionName: string, field
} }
if (apikey !== null && apikey.trim().length > 0) { if (apikey !== null && apikey.trim().length > 0) {
fields.apikey = fields.apikey || fields.api_key; fields.apikey = fields.apikey || fields.api_key || fields.authorization;
// API key is configured, check if it is valid // API key is configured, check if it is valid
if (fields.apikey !== apikey!.trim()) { if (fields.apikey !== apikey!.trim()) {
throw new createHTTPError.Unauthorized('no or wrong API Key'); throw new createHTTPError.Unauthorized('no or wrong API Key');

View file

@ -756,7 +756,6 @@ const lookupEnvironmentVariables = (obj: MapArrayType<any>) => {
//console.log(root.collectFromLeafsUpwards()) //console.log(root.collectFromLeafsUpwards())
const rooting = root.collectFromLeafsUpwards() const rooting = root.collectFromLeafsUpwards()
console.log("Rooting is", rooting.ADMIN)
obj = Object.assign(obj, rooting) obj = Object.assign(obj, rooting)
return obj; return obj;
}; };

View file

@ -70,7 +70,6 @@ const tsortTest = () => {
]; ];
let sorted = tsort(edges); let sorted = tsort(edges);
console.log(sorted);
// example 2: failure ( A > B > C > A ) // example 2: failure ( A > B > C > A )
edges = [ edges = [