fastify-txstate 3.6.8 → 3.6.9
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/lib/unified-auth.js +23 -6
- package/package.json +1 -1
package/lib/unified-auth.js
CHANGED
|
@@ -196,9 +196,17 @@ function registerUaCookieRoutes(app) {
|
|
|
196
196
|
const redirectUrl = req.auth?.issuerConfig?.logoutUrl && (0, txstate_utils_1.isNotBlank)(req.auth.token)
|
|
197
197
|
? `${req.auth.issuerConfig.logoutUrl.toString()}?unifiedJwt=${encodeURIComponent(req.auth.token)}`
|
|
198
198
|
: (process.env.PUBLIC_URL || new URL('..', req.url).toString());
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
void res.header('Set-Cookie', `${uaCookieName}=; Path=/; Secure; HttpOnly; SameSite=Lax; Expires=Thu, 01 Jan 1970 00:00:00 GMT`);
|
|
200
|
+
return `<!DOCTYPE html>
|
|
201
|
+
<html lang="en">
|
|
202
|
+
<head>
|
|
203
|
+
<meta charset="UTF-8">
|
|
204
|
+
<meta http-equiv="refresh" content="0; url=${(0, txstate_utils_1.htmlEncode)(redirectUrl)}">
|
|
205
|
+
<title>Logging out...</title>
|
|
206
|
+
</head>
|
|
207
|
+
<body>
|
|
208
|
+
</body>
|
|
209
|
+
</html>`;
|
|
202
210
|
});
|
|
203
211
|
app.get('/.uaService', {
|
|
204
212
|
schema: {
|
|
@@ -213,9 +221,18 @@ function registerUaCookieRoutes(app) {
|
|
|
213
221
|
}
|
|
214
222
|
}
|
|
215
223
|
}, async (req, res) => {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
224
|
+
void res.header('Set-Cookie', `${uaCookieName}=${req.query.unifiedJwt}; Path=/; Secure; HttpOnly; SameSite=Lax`);
|
|
225
|
+
void res.type('text/html');
|
|
226
|
+
return `<!DOCTYPE html>
|
|
227
|
+
<html lang="en">
|
|
228
|
+
<head>
|
|
229
|
+
<meta charset="UTF-8">
|
|
230
|
+
<meta http-equiv="refresh" content="0; url=${(0, txstate_utils_1.htmlEncode)(req.query.requestedUrl ?? (process.env.PUBLIC_URL || new URL('..', req.url).toString()))}">
|
|
231
|
+
<title>Logging in...</title>
|
|
232
|
+
</head>
|
|
233
|
+
<body>
|
|
234
|
+
</body>
|
|
235
|
+
</html>`;
|
|
219
236
|
});
|
|
220
237
|
/**
|
|
221
238
|
* In the case of a client-side application that uses the UA cookie to authenticate,
|