mirror of
https://github.com/sasjs/server.git
synced 2026-01-11 08:20:04 +00:00
feat: bypass authentication when route is enabled for public group
This commit is contained in:
@@ -5,7 +5,9 @@ import {
|
||||
fetchLatestAutoExec,
|
||||
ModeType,
|
||||
verifyTokenInDB,
|
||||
isAuthorizingRoute
|
||||
isAuthorizingRoute,
|
||||
isPublicRoute,
|
||||
publicUser
|
||||
} from '../utils'
|
||||
import { desktopUser } from './desktop'
|
||||
import { authorize } from './authorize'
|
||||
@@ -21,6 +23,11 @@ export const authenticateAccessToken: RequestHandler = async (
|
||||
return next()
|
||||
}
|
||||
|
||||
if (await isPublicRoute(req)) {
|
||||
req.user = publicUser
|
||||
return next()
|
||||
}
|
||||
|
||||
const nextFunction = isAuthorizingRoute(req)
|
||||
? () => authorize(req, res, next)
|
||||
: next
|
||||
|
||||
Reference in New Issue
Block a user