From f36f528b78464096cd1e77e0639844a0855b6d0c Mon Sep 17 00:00:00 2001 From: Bruce Schultz Date: Thu, 4 Jul 2024 14:01:58 +0200 Subject: [PATCH] revert(middleware): revert middleware to reenable navigation guards --- middleware/auth.ts | 7 +++++++ nuxt.config.ts | 4 ++-- pages/about.vue | 6 +++++- pages/analyses.vue | 4 ++++ pages/data-stores/create.vue | 4 ++++ pages/data-stores/index.vue | 4 ++++ pages/projects.vue | 4 ++++ pages/proposals.vue | 4 ++++ 8 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 middleware/auth.ts diff --git a/middleware/auth.ts b/middleware/auth.ts new file mode 100644 index 0000000..e67f788 --- /dev/null +++ b/middleware/auth.ts @@ -0,0 +1,7 @@ +export default defineNuxtRouteMiddleware(async () => { + const { loggedIn, login } = useOidcAuth(); + if (!loggedIn.value) { + console.warn("Not logged in"); + return login(); + } +}); diff --git a/nuxt.config.ts b/nuxt.config.ts index 03ea451..0ec7145 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -36,12 +36,12 @@ export default defineNuxtConfig({ }, }, session: { - expirationCheck: false, + expirationCheck: true, automaticRefresh: true, maxAge: 3600, }, middleware: { - globalMiddlewareEnabled: true, + globalMiddlewareEnabled: false, customLoginPage: false, }, }, diff --git a/pages/about.vue b/pages/about.vue index ad1b413..1856c63 100644 --- a/pages/about.vue +++ b/pages/about.vue @@ -1,4 +1,8 @@ - +