Skip to content

Commit c6b5b2c

Browse files
author
Benoît Ngô
committed
Adding mock saml2, adding logs rules for makefile
1 parent 20c31ed commit c6b5b2c

File tree

6 files changed

+63
-46
lines changed

6 files changed

+63
-46
lines changed

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
# Change tabs to space in makefile
33

44
# Load .env variable (the prod is added also if there is any)
5+
ifneq (,$(wildcard ./.env.dist))
6+
include .env.dist
7+
export
8+
endif
59
ifneq (,$(wildcard ./.env))
610
include .env
711
export
812
endif
913
ifneq (,$(wildcard ./.env.prod))
10-
include .env
14+
include .env.prod
1115
export
1216
endif
1317

@@ -44,9 +48,13 @@ db-migrate-diff: ;\
4448
docker compose exec back composer -- run console doctrine:migrations:diff -n
4549

4650
# See logs of back
47-
.PHONY: backlogs
48-
backlogs: ;\
51+
.PHONY: blogs
52+
blogs: ;\
4953
docker-compose logs back -f
54+
55+
.PHONY: flogs
56+
flogs: ;\
57+
docker-compose logs front -f
5058
# Init dev env
5159
init-dev: ;\
5260
cp -n docker-compose.override.yml.template docker-compose.override.yml; \
@@ -63,7 +71,7 @@ down: ;\
6371
docker compose down
6472
# up docker compose
6573
up: ;\
66-
DOCKER_BUILDKIT=1 docker compose up -d
74+
DOCKER_BUILDKIT=1 docker compose up -d ; docker compose logs initback back front -f
6775

6876
# stronger down (remove volume / image / orphans)
6977
.PHONY: fdown

apps/front/nuxt.config.ts

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,37 @@
11
// https://nuxt.com/docs/api/configuration/nuxt-config
22
export default defineNuxtConfig({
3-
srcDir: "src/",
4-
modules: [
5-
'@pinia/nuxt',
6-
],
7-
runtimeConfig: {
8-
API_URL: process.env.API_URL || '',
9-
public: {
10-
DISABLE_AUTHENTICATION: process.env.DISABLE_AUTHENTICATION || ''
11-
}
12-
},
13-
app: {
3+
srcDir: 'src/',
4+
modules: [
5+
'@pinia/nuxt',
6+
],
7+
runtimeConfig: {
8+
API_URL: process.env.API_URL || '',
9+
},
10+
app: {
1411

15-
head: {
16-
// @see https://getbootstrap.com/docs/5.0/getting-started/introduction/#starter-template
17-
charset: 'utf-8',
18-
viewport: 'width=device-width, initial-scale=1',
19-
title: 'KB Backbone',
20-
meta: [
21-
// <meta name="description" content="My amazing site">
22-
// { name: 'description', content: 'My amazing site.' }
23-
],
24-
}
12+
head: {
13+
// @see https://getbootstrap.com/docs/5.0/getting-started/introduction/#starter-template
14+
charset: 'utf-8',
15+
viewport: 'width=device-width, initial-scale=1',
16+
title: 'KB Backbone',
17+
meta: [
18+
// <meta name="description" content="My amazing site">
19+
// { name: 'description', content: 'My amazing site.' }
20+
],
21+
},
22+
},
23+
css: [
24+
'@/assets/styles/main.scss',
25+
],
26+
vite: {
27+
css: {
28+
preprocessorOptions: {
29+
scss: {
30+
additionalData: '@import "@/assets/styles/_functions.scss";@import "@/assets/styles/_variables.scss";@import "@/assets/styles/_mixins.scss";',
31+
},
32+
},
2533
},
26-
css: [
27-
// "bootstrap/dist/css/bootstrap.min.css",
28-
'@/assets/styles/main.scss'
29-
],
30-
vite: {
31-
css: {
32-
preprocessorOptions: {
33-
scss: {
34-
additionalData: '@import "@/assets/styles/_functions.scss";@import "@/assets/styles/_variables.scss";@import "@/assets/styles/_mixins.scss";'
35-
}
36-
}
37-
}
38-
}
39-
//ssr: false
34+
},
35+
// ssr: false
4036

41-
})
37+
});

apps/front/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"generate": "nuxt generate",
77
"preview": "nuxt preview",
88
"postinstall": "nuxt prepare",
9-
"lint": "eslint ./src/"
9+
"lint": "eslint nuxt.config.ts --fix ; eslint ./src/"
1010
},
1111
"devDependencies": {
1212
"@nuxt/eslint-config": "^0.1.1",

apps/front/src/app.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ const route = useRoute();
1818
const mHandleError = (e) => {
1919
logger.error('Primary error boundary', e);
2020
};
21-
22-
const { DISABLE_AUTHENTICATION } = useRuntimeConfig();
21+
const isPendingValue = computed(() => authStore.isPending);
2322
// Doing this here instead than in the middleware allow reactivity on the auth user
2423
watchEffect(async () => {
25-
if (authStore.isPending) {
24+
if (isPendingValue.value) {
2625
return;
2726
}
28-
const shouldRedirectToLogin = !DISABLE_AUTHENTICATION && !authStore.isAuthenticated && authStore.authUrl && route.name !== 'auth-login';
27+
const shouldRedirectToLogin = !authStore.isAuthenticated && authStore.authUrl && route.name !== 'auth-login';
2928
if (shouldRedirectToLogin) {
3029
await navigateTo(authStore.authUrl, { external: true });
3130
}

docker-compose.override.yml.template

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,21 @@ services:
5555
mysql:
5656
volumes:
5757
- ./apps/back/dump/dump.sql:/docker-entrypoint-initdb.d/001-dump.sql
58+
59+
samltest:
60+
image: kristophjunge/test-saml-idp
61+
labels:
62+
- traefik.enable=true
63+
- traefik.http.routers.samltest.rule=Host(`samltest.$BASE_DOMAIN`)
64+
- traefik.http.routers.samltest.service=samltest
65+
- traefik.http.services.samltest.loadbalancer.server.port=8080
66+
environment:
67+
- SIMPLESAMLPHP_SP_ENTITY_ID=http://$BASE_DOMAIN
68+
- SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE=http://$BASE_DOMAIN/api/1.0/auth/sso/saml2/login
69+
- SIMPLESAMLPHP_SP_SINGLE_LOGOUT_SERVICE=http://$API_DOMAIN/api/1.0/auth/sso/saml2/logout
70+
volumes:
71+
- ./apps/ssoidp/idpUser.php:/var/www/simplesamlphp/config/authsources.php
72+
5873
networks:
5974
# This could be very usefull to run multiple project on the same machine
6075
tcm_network:

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ services:
4343
environment:
4444
# This is used only per the proxy
4545
- NUXT_API_URL=http://${API_DOMAIN}/
46-
#- NUXT_PUBLIC_DISABLE_AUTHENTICATION=true
4746
proxy:
4847
image: traefik:3.0
4948
container_name: tcm_proxy

0 commit comments

Comments
 (0)