@raketa-cloud/admin 0.0.75 → 0.0.77
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.
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import AuthHelper from "./helpers/AuthHelper";
|
|
|
6
6
|
function getAuthBearer(c) {
|
|
7
7
|
const authHeader = c.req.header("Authorization") || "";
|
|
8
8
|
|
|
9
|
-
return authHeader.replace("Bearer
|
|
9
|
+
return authHeader.replace("Bearer", "").trim();
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const setupAuthentication = (app, config) => {
|
|
@@ -67,7 +67,6 @@ const setupAuthentication = (app, config) => {
|
|
|
67
67
|
|
|
68
68
|
app.get("/logout", (c) => {
|
|
69
69
|
deleteCookie(c, AuthHelper.cookie_key);
|
|
70
|
-
deleteCookie(c, config.remoteConfig.cookie_key);
|
|
71
70
|
return c.redirect("/login");
|
|
72
71
|
});
|
|
73
72
|
|
|
@@ -94,13 +93,16 @@ const setupAuthentication = (app, config) => {
|
|
|
94
93
|
app.get("/profile", (c) => {
|
|
95
94
|
const token = getAuthBearer(c);
|
|
96
95
|
|
|
97
|
-
// TODO: Here we may update the Gateway API to have the check
|
|
96
|
+
// TODO: Here we may update the Gateway API to have the check dynamically done in the backend!
|
|
98
97
|
if (AuthHelper.verifyJWT(token)) {
|
|
99
|
-
c.res.status = 200;
|
|
100
98
|
return c.json({ message: "OK" });
|
|
101
99
|
} else {
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
return new Response("Unauthorized", {
|
|
101
|
+
status: 401,
|
|
102
|
+
headers: {
|
|
103
|
+
Authenticate: 'error="invalid_token"',
|
|
104
|
+
},
|
|
105
|
+
});
|
|
104
106
|
}
|
|
105
107
|
});
|
|
106
108
|
};
|