mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 09:45:36 +08:00
Fix authentication for regular users by validating JWT tokens
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
1 parent
bf9be821ba
commit
6aefc61be6
2 files changed
+43
-14
No files matched your search
@@ -88,6 +88,13 @@ export default ({ app }: { app: Application }) => {
|
||||
return next();
|
||||
}
|
||||
|
||||
// If JWT has been successfully verified by expressjwt middleware, allow the request
|
||||
// This handles regular users whose tokens are not stored in authInfo
|
||||
if (req.auth) {
|
||||
return next();
|
||||
}
|
||||
|
||||
// For system admin, also check against stored token
|
||||
const authInfo = await shareStore.getAuthInfo();
|
||||
if (authInfo && headerToken) {
|
||||
const { token = '', tokens = {} } = authInfo;
|
||||
|
||||
Reference in new issue
Block a user