Refactor auth middleware and add logout functionality

Since there are multiple significant changes, a message body is
warranted:

- Replace token refresh logic with simple route protection - Move cookie
deletion to new system store - Add logout button and handler to index
page - Rename Chuck Norris store for consistency
This commit is contained in:
2025-08-11 15:22:39 +02:00
parent 65e0c583cf
commit b607380a68
5 changed files with 47 additions and 33 deletions

View File

@@ -8,7 +8,7 @@ export default defineNuxtConfig({
baseURL: "http://localhost:3000",
},
auth: {
globalAppMiddleware: true,
globalAppMiddleware: false,
baseURL: "http://localhost:8000/auth",
provider: {
type: "local",
@@ -17,7 +17,7 @@ export default defineNuxtConfig({
type: "JWT",
headerName: "Authorization",
cookieName: "authls.atoken",
maxAgeInSeconds: 30 * 60,
maxAgeInSeconds: 30 * 59,
},
refresh: {
isEnabled: true,
@@ -28,7 +28,7 @@ export default defineNuxtConfig({
refreshResponseTokenPointer: "/access",
refreshRequestTokenPointer: "/refresh",
cookieName: "authls.rtoken",
maxAgeInSeconds: 60 * 60 * 24,
maxAgeInSeconds: 60 * 60 * 23, // En 23 horas refresca automáticamente
sameSiteAttribute: "strict",
},
},