mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Compare commits
2 commits
ba77b73899
...
3027c0bc1f
| Author | SHA1 | Date | |
|---|---|---|---|
| 3027c0bc1f | |||
| b04e9216dc |
3 changed files with 199 additions and 20 deletions
96
docker-compose-auth.yaml
Normal file
96
docker-compose-auth.yaml
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
context: ./client
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: frontend
|
||||||
|
ports:
|
||||||
|
- "5173:5173"
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
context: ./server
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: backend
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
PORT: 3000
|
||||||
|
MONGO_URI: "mongodb://mongo:27017/evaluetonsavoir"
|
||||||
|
MONGO_DATABASE: evaluetonsavoir
|
||||||
|
EMAIL_SERVICE: gmail
|
||||||
|
SENDER_EMAIL: infoevaluetonsavoir@gmail.com
|
||||||
|
EMAIL_PSW: 'vvml wmfr dkzb vjzb'
|
||||||
|
JWT_SECRET: haQdgd2jp09qb897GeBZyJetC8ECSpbFJe
|
||||||
|
SESSION_Secret: 'lookMomImQuizzing'
|
||||||
|
SITE_URL: http://localhost
|
||||||
|
FRONTEND_PORT: 5173
|
||||||
|
USE_PORTS: false
|
||||||
|
AUTHENTICATED_ROOMS: false
|
||||||
|
volumes:
|
||||||
|
- ./server/auth_config.json:/usr/src/app/serveur/config/auth_config.json
|
||||||
|
depends_on:
|
||||||
|
- mongo
|
||||||
|
- keycloak
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
# Ce conteneur sert de routeur pour assurer le bon fonctionnement de l'application
|
||||||
|
nginx:
|
||||||
|
image: fuhrmanator/evaluetonsavoir-routeur:latest
|
||||||
|
container_name: nginx
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
|
- frontend
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
# Ce conteneur est la base de données principale pour l'application
|
||||||
|
mongo:
|
||||||
|
image: mongo
|
||||||
|
container_name: mongo
|
||||||
|
ports:
|
||||||
|
- "27017:27017"
|
||||||
|
tty: true
|
||||||
|
volumes:
|
||||||
|
- mongodb_data:/data/db
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
# Ce conteneur assure que l'application est à jour en allant chercher s'il y a des mises à jours à chaque heure
|
||||||
|
watchtower:
|
||||||
|
image: containrrr/watchtower
|
||||||
|
container_name: watchtower
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
environment:
|
||||||
|
- TZ=America/Montreal
|
||||||
|
- WATCHTOWER_CLEANUP=true
|
||||||
|
- WATCHTOWER_DEBUG=true
|
||||||
|
- WATCHTOWER_INCLUDE_RESTARTING=true
|
||||||
|
- WATCHTOWER_SCHEDULE=0 0 5 * * * # At 5 am everyday
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
keycloak:
|
||||||
|
container_name: keycloak
|
||||||
|
image: quay.io/keycloak/keycloak:latest
|
||||||
|
environment:
|
||||||
|
KEYCLOAK_ADMIN: admin
|
||||||
|
KEYCLOAK_ADMIN_PASSWORD: admin123
|
||||||
|
KC_HEALTH_ENABLED: 'true'
|
||||||
|
KC_FEATURES: preview
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
volumes:
|
||||||
|
- ./oauth-tester/config.json:/opt/keycloak/data/import/realm-config.json
|
||||||
|
command:
|
||||||
|
- start-dev
|
||||||
|
- --import-realm
|
||||||
|
- --hostname-strict=false
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mongodb_data:
|
||||||
|
external: false
|
||||||
96
oauth-tester/config.json
Normal file
96
oauth-tester/config.json
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
{
|
||||||
|
"id": "test-realm",
|
||||||
|
"realm": "EvalueTonSavoir",
|
||||||
|
"enabled": true,
|
||||||
|
"users": [
|
||||||
|
{
|
||||||
|
"username": "teacher",
|
||||||
|
"enabled": true,
|
||||||
|
"credentials": [
|
||||||
|
{
|
||||||
|
"type": "password",
|
||||||
|
"value": "teacher123",
|
||||||
|
"temporary": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"groups": ["teachers"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"username": "student",
|
||||||
|
"enabled": true,
|
||||||
|
"credentials": [
|
||||||
|
{
|
||||||
|
"type": "password",
|
||||||
|
"value": "student123",
|
||||||
|
"temporary": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"groups": ["students"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"name": "teachers",
|
||||||
|
"attributes": {
|
||||||
|
"role": ["teacher"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "students",
|
||||||
|
"attributes": {
|
||||||
|
"role": ["student"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"roles": {
|
||||||
|
"realm": [
|
||||||
|
{
|
||||||
|
"name": "teacher",
|
||||||
|
"description": "Teacher role"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "student",
|
||||||
|
"description": "Student role"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"clientId": "evaluetonsavoir-client",
|
||||||
|
"enabled": true,
|
||||||
|
"publicClient": false,
|
||||||
|
"clientAuthenticatorType": "client-secret",
|
||||||
|
"secret": "your-secret-key-123",
|
||||||
|
"redirectUris": ["http://localhost:5173/*","http://localhost/*"],
|
||||||
|
"webOrigins": ["http://localhost:5173","http://localhost/"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"clientScopes": [
|
||||||
|
{
|
||||||
|
"name": "group",
|
||||||
|
"description": "Group scope for access control",
|
||||||
|
"protocol": "openid-connect",
|
||||||
|
"attributes": {
|
||||||
|
"include.in.token.scope": "true",
|
||||||
|
"display.on.consent.screen": "true"
|
||||||
|
},
|
||||||
|
"protocolMappers": [
|
||||||
|
{
|
||||||
|
"name": "group mapper",
|
||||||
|
"protocol": "openid-connect",
|
||||||
|
"protocolMapper": "oidc-usermodel-attribute-mapper",
|
||||||
|
"consentRequired": false,
|
||||||
|
"config": {
|
||||||
|
"userinfo.token.claim": "true",
|
||||||
|
"user.attribute": "group",
|
||||||
|
"id.token.claim": "true",
|
||||||
|
"access.token.claim": "true",
|
||||||
|
"claim.name": "group",
|
||||||
|
"jsonType.label": "String"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"defaultDefaultClientScopes": ["group"]
|
||||||
|
}
|
||||||
|
|
@ -3,27 +3,14 @@
|
||||||
"passportjs":
|
"passportjs":
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"gmatte": {
|
"oidc_local": {
|
||||||
"type": "oauth",
|
|
||||||
"OAUTH_AUTHORIZATION_URL": "https://auth.gmatte.xyz/application/o/authorize/",
|
|
||||||
"OAUTH_TOKEN_URL": "https://auth.gmatte.xyz/application/o/token/",
|
|
||||||
"OAUTH_USERINFO_URL": "https://auth.gmatte.xyz/application/o/userinfo/",
|
|
||||||
"OAUTH_CLIENT_ID": "clientID",
|
|
||||||
"OAUTH_CLIENT_SECRET": "clientSecret",
|
|
||||||
"OAUTH_ADD_SCOPE": "groups",
|
|
||||||
"OAUTH_ROLE_TEACHER_VALUE": "groups_evaluetonsavoir-prof",
|
|
||||||
"OAUTH_ROLE_STUDENT_VALUE": "groups_evaluetonsavoir"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"oidc_gmatte": {
|
|
||||||
"type": "oidc",
|
"type": "oidc",
|
||||||
"OIDC_CONFIG_URL": "https://auth.gmatte.xyz/application/o/evaluetonsavoir/.well-known/openid-configuration",
|
"OIDC_CONFIG_URL": "http://localhost:8080/realms/EvalueTonSavoir/.well-known/openid-configuration",
|
||||||
"OIDC_CLIENT_ID": "clientID",
|
"OIDC_CLIENT_ID": "evaluetonsavoir-client",
|
||||||
"OIDC_CLIENT_SECRET": "clientSecret",
|
"OIDC_CLIENT_SECRET": "your-secret-key-123",
|
||||||
"OIDC_ADD_SCOPE": "groups",
|
"OIDC_ADD_SCOPE": "group",
|
||||||
"OIDC_ROLE_TEACHER_VALUE": "groups_evaluetonsavoir-prof",
|
"OIDC_ROLE_TEACHER_VALUE": "teachers",
|
||||||
"OIDC_ROLE_STUDENT_VALUE": "groups_evaluetonsavoir"
|
"OIDC_ROLE_STUDENT_VALUE": "students"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue