mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 06:03:34 +01:00
Fixed api query authorization (#6404)
* Fixed api query authorization * Fixed api query authorization
This commit is contained in:
parent
63e9b2d4eb
commit
95328dcaeb
3 changed files with 3926 additions and 4941 deletions
|
@ -46,5 +46,6 @@
|
|||
"url": "https://github.com/ether/etherpad-lite.git"
|
||||
},
|
||||
"version": "2.0.3",
|
||||
"license": "Apache-2.0"
|
||||
"license": "Apache-2.0",
|
||||
"packageManager": "pnpm@8.15.6+sha256.01c01eeb990e379b31ef19c03e9d06a14afa5250b82e81303f88721c99ff2e6f"
|
||||
}
|
||||
|
|
8857
pnpm-lock.yaml
8857
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -175,9 +175,7 @@ exports.handle = async function (apiVersion: string, functionName: string, field
|
|||
throw new createHTTPError.NotFound('no such function');
|
||||
}
|
||||
|
||||
if(!req.headers.authorization) {
|
||||
throw new createHTTPError.Unauthorized('no or wrong API Key');
|
||||
}
|
||||
|
||||
|
||||
if (apikey !== null && apikey.trim().length > 0) {
|
||||
fields.apikey = fields.apikey || fields.api_key || fields.authorization;
|
||||
|
@ -186,6 +184,9 @@ exports.handle = async function (apiVersion: string, functionName: string, field
|
|||
throw new createHTTPError.Unauthorized('no or wrong API Key');
|
||||
}
|
||||
} else {
|
||||
if(!req.headers.authorization) {
|
||||
throw new createHTTPError.Unauthorized('no or wrong API Key');
|
||||
}
|
||||
try {
|
||||
await jwtVerify(req.headers.authorization!.replace("Bearer ", ""), publicKeyExported!, {algorithms: ['RS256'],
|
||||
requiredClaims: ["admin"]})
|
||||
|
|
Loading…
Reference in a new issue