Skip to content

Commit bc72148

Browse files
committed
1 parent bf19b87 commit bc72148

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

adminforth/servers/express.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class ExpressServer implements IExpressHttpServer {
217217
this.server.listen(...args);
218218
}
219219

220-
async processAuthorizeCallbacks(adminUser: AdminUser, toReturn: { error?: string, allowed: boolean }, response: Response, extra: any) {
220+
async processAuthorizeCallbacks(adminUser: AdminUser, toReturn: { error?: string, allowed: boolean }, response: Response, extra: HttpExtra) {
221221
const adminUserAuthorize = this.adminforth.config.auth.adminUserAuthorize as (AdminUserAuthorizeFunction[] | undefined);
222222

223223
for (const hook of listify(adminUserAuthorize)) {
@@ -269,7 +269,15 @@ class ExpressServer implements IExpressHttpServer {
269269
} else {
270270
req.adminUser = adminforthUser;
271271
const toReturn: { error?: string, allowed: boolean } = { allowed: true };
272-
await this.processAuthorizeCallbacks(adminforthUser, toReturn, res, {});
272+
await this.processAuthorizeCallbacks(adminforthUser, toReturn, res, {
273+
body: req.body,
274+
query: req.query,
275+
headers: req.headers,
276+
cookies: cookies as any,
277+
requestUrl: req.url,
278+
meta: {},
279+
response: res
280+
});
273281
if (!toReturn.allowed) {
274282
res.status(401).send('Unauthorized by AdminForth');
275283
} else {

0 commit comments

Comments
 (0)