@tmlmobilidade/fastify 20260515.1056.47 → 20260517.1740.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,7 +18,7 @@ export function authorizationMiddleware(scope, actions, requireAll = false) {
|
|
|
18
18
|
if (!sessionToken) {
|
|
19
19
|
return reply
|
|
20
20
|
.setCookie(AUTH_SESSION_COOKIE_NAME, '', { httpOnly: true, maxAge: 0, path: '/', sameSite: 'lax', secure: true })
|
|
21
|
-
.send({ data: 'Session token is missing',
|
|
21
|
+
.send({ data: null, error: 'Session token is missing', statusCode: HTTP_STATUS.UNAUTHORIZED });
|
|
22
22
|
}
|
|
23
23
|
//
|
|
24
24
|
// Get user and permissions from cache or auth provider.
|
|
@@ -31,7 +31,7 @@ export function authorizationMiddleware(scope, actions, requireAll = false) {
|
|
|
31
31
|
if (!userData || !permissionsData || !organizationData) {
|
|
32
32
|
return reply
|
|
33
33
|
.setCookie(AUTH_SESSION_COOKIE_NAME, '', { httpOnly: true, maxAge: 0, path: '/', sameSite: 'lax', secure: true })
|
|
34
|
-
.send({ data:
|
|
34
|
+
.send({ data: null, error: 'User, Permissions or Organization not found', statusCode: HTTP_STATUS.UNAUTHORIZED });
|
|
35
35
|
}
|
|
36
36
|
request.me = userData;
|
|
37
37
|
request.permissions = permissionsData;
|
|
@@ -41,7 +41,7 @@ export function authorizationMiddleware(scope, actions, requireAll = false) {
|
|
|
41
41
|
console.error('Authorization Middleware Error:', error);
|
|
42
42
|
return reply
|
|
43
43
|
.setCookie(AUTH_SESSION_COOKIE_NAME, '', { httpOnly: true, maxAge: 0, path: '/', sameSite: 'lax', secure: true })
|
|
44
|
-
.send({ data:
|
|
44
|
+
.send({ data: null, error: 'Authorization Middleware Error', statusCode: HTTP_STATUS.UNAUTHORIZED });
|
|
45
45
|
}
|
|
46
46
|
//
|
|
47
47
|
// Evaluate the retrieved permissions,
|