From 390c36fd1100f2d1055d9286bac45395c22dc25b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Mon, 3 Jul 2023 15:37:34 +0200 Subject: [PATCH] Optimalizace. Pokus bez static --- .gitignore | 1 + layouts/default.vue | 2 +- nuxt.config.js | 19 ++++++++----------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 45acc07..445f17c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules dist .nuxt +_work diff --git a/layouts/default.vue b/layouts/default.vue index 5f821f7..3f0084f 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -91,7 +91,7 @@ export default { "https://iapi.pirati.cz/v1/groups", { // headers: { -// "X-Authorization": this.$cookie.get('auth._token.keycloak') +// "Authorization": this.$cookie.get('auth._token.keycloak') // } } ).then(res => res.json() ) diff --git a/nuxt.config.js b/nuxt.config.js index ad88466..f710d91 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -1,5 +1,6 @@ export default { - target: 'static', +// target: 'static', + modules: [ '@nuxtjs/dotenv', '@nuxtjs/axios', @@ -7,37 +8,33 @@ export default { '@leandromatos/nuxt-cookie', '@nuxtjs/vuetify' ], + auth: { strategies: { - - keycloak: { + keycloak: { scheme: 'oauth2', endpoints: { authorization: `${process.env.KEYCLOAK_REMOTE_HOST}/auth/realms/${process.env.KEYCLOAK_REALM}/protocol/openid-connect/auth`, - token: undefined, userInfo: `${process.env.KEYCLOAK_REMOTE_HOST}/auth/realms/${process.env.KEYCLOAK_REALM}/protocol/openid-connect/userinfo`, + token: undefined, logout: `${process.env.KEYCLOAK_REMOTE_HOST}/auth/realms/${process.env.KEYCLOAK_REALM}/protocol/openid-connect/logout?redirect_uri=` + encodeURIComponent(String(process.env.REMOTE_API)) }, token: { property: 'access_token', type: 'Bearer', - name: 'Authorization', - maxAge: 1800 + maxAge: 1800, }, refreshToken: { property: 'refresh_token', maxAge: 60 * 60 * 24 * 30 }, - responseType: 'token', grantType: 'authorization_code', clientId: process.env.KEYCLOAK_CLIENT_ID, scope: ['openid', 'profile'], codeChallengeMethod: 'S256', } - }, + } } -} - - +} -- GitLab