From e56fae9d337f26f30ba88645483f88933b674f1d Mon Sep 17 00:00:00 2001 From: Bruce Schultz Date: Tue, 13 Aug 2024 15:07:26 +0200 Subject: [PATCH] fix(token): fix token error from nuxt-oidc-auth in k8s --- .dockerignore | 1 - .gitignore | 4 +- README.MD | 17 ++++- components/KeycloakAuth.vue | 19 ++--- components/MenuHeader.vue | 19 +++-- .../data-stores/managers/DataStoreCreator.vue | 2 +- components/login/AvatarButton.vue | 20 ++---- composables/useAPIFetch.ts | 44 ++---------- composables/useServices.ts | 12 ---- docker-compose.yml | 21 +++--- middleware/auth.global.ts | 23 ------- middleware/auth.ts | 7 ++ nuxt.config.ts | 46 ++++++++++--- package.json | 8 +-- pages/analyses.vue | 6 +- pages/auth/callback.vue | 22 ------ pages/auth/logout.vue | 22 ------ pages/auth/silent-refresh.vue | 24 ------- pages/data-stores/create.vue | 4 ++ pages/data-stores/index.vue | 4 ++ pages/projects.vue | 4 ++ pages/proposals.vue | 4 ++ plugins/api.ts | 33 +++++++++ server/tsconfig.json | 3 + services/application-service.ts | 11 --- services/auth-service.ts | 61 ---------------- stores/auth.ts | 36 ---------- yarn.lock | 69 +++++++++++-------- 28 files changed, 200 insertions(+), 346 deletions(-) delete mode 100644 composables/useServices.ts delete mode 100644 middleware/auth.global.ts create mode 100644 middleware/auth.ts delete mode 100644 pages/auth/callback.vue delete mode 100644 pages/auth/logout.vue delete mode 100644 pages/auth/silent-refresh.vue create mode 100644 plugins/api.ts create mode 100644 server/tsconfig.json delete mode 100644 services/application-service.ts delete mode 100644 services/auth-service.ts delete mode 100644 stores/auth.ts diff --git a/.dockerignore b/.dockerignore index 5d7203f..1f7cc2c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,3 @@ node_modules .nuxt -.env.backup .env diff --git a/.gitignore b/.gitignore index 76690e4..dfa5f5f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,10 @@ tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo # local env files -.env.backup +.env .env.*.local .env.production -.env +.env.backup # Logs /logs diff --git a/README.MD b/README.MD index d0aa6aa..afd1958 100644 --- a/README.MD +++ b/README.MD @@ -4,7 +4,18 @@ NUXT_PUBLIC_BASE_URL="http://localhost:3000" # URL of the website NUXT_PUBLIC_HUB_ADAPTER_URL="http://urlForHubAdapterApi.de" # URL for hub adapter API -NUXT_KEYCLOAK_BASE_URL="http://your.keycloak.instance.de/realms/flame" # Keycloak endpoint and realm -NUXT_KEYCLOAK_CLIENT_ID="node-ui" -NUXT_KEYCLOAK_CLIENT_SECRET="someSecret" +NUXT_OIDC_PROVIDERS_KEYCLOAK_BASE_URL="http://your.keycloak.instance.de/realms/flame" +NUXT_OIDC_PROVIDERS_KEYCLOAK_CLIENT_ID="node-ui" +NUXT_OIDC_PROVIDERS_KEYCLOAK_CLIENT_SECRET="someSecret" + +# Nuxt OIDC Tokens +# https://nuxt.com/modules/nuxt-oidc-auth#_3-set-secrets +# NOTE: These will automatically be generated in helm/docker so they do not need to be explicitly set + +# NUXT_OIDC_TOKEN_KEY is a cryptographic AES key in base64 used to encrypt the server side token store +NUXT_OIDC_TOKEN_KEY=xxx +# NUXT_OIDC_SESSION_SECRET is a 48 character random string that encrypts the user session +NUXT_OIDC_SESSION_SECRET=xxx +# NUXT_OIDC_AUTH_SESSION_SECRET is a 48 character random string that encrypts individual sessions during OAuth flows +NUXT_OIDC_AUTH_SESSION_SECRET=xxx ``` diff --git a/components/KeycloakAuth.vue b/components/KeycloakAuth.vue index 3d299f4..86e6012 100644 --- a/components/KeycloakAuth.vue +++ b/components/KeycloakAuth.vue @@ -1,24 +1,15 @@