mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Auth config
.env.auth for docker-compose and Load environment variables in the backend
This commit is contained in:
parent
023476dd0b
commit
320f98a8a7
3 changed files with 54 additions and 0 deletions
22
.env.auth
Normal file
22
.env.auth
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Type of Autorizarions
|
||||
SIMPLE_LOGIN_ACTIVE=false
|
||||
OAUTH_ACTIVE=false
|
||||
OIDC_ACTIVE=false
|
||||
|
||||
# Configuration Simple Login
|
||||
SESSION_SECRET=your_session_secret
|
||||
|
||||
# Configuration OAuth
|
||||
OAUTH_AUTHORIZATION_URL=https://www.testurl.com/oauth2/authorize
|
||||
OAUTH_TOKEN_URL=https://www.testurl.com/oauth2/token
|
||||
OAUTH_CLIENT_ID=your_oauth_client_id
|
||||
OAUTH_CLIENT_SECRET=your_oauth_client_secret
|
||||
OAUTH_CALLBACK_URL=https://localhost:3000/auth/provider/callback
|
||||
OAUTH_ADD_SCOPE=scopes
|
||||
OAUTH_ROLE_TEACHER_VALUE=teacher-claim-value
|
||||
|
||||
# Configuration OIDC
|
||||
OIDC_CLIENT_ID=your_oidc_client_id
|
||||
OIDC_CLIENT_SECRET=your_oidc_client_secret
|
||||
OIDC_ISSUER_URL=https://your-issuer.com
|
||||
OIDC_CALLBACK_URL=http://localhost:3000/auth/oidc/callback
|
||||
|
|
@ -14,6 +14,8 @@ services:
|
|||
container_name: backend
|
||||
ports:
|
||||
- "3000:3000"
|
||||
env_file:
|
||||
- .env.auth
|
||||
environment:
|
||||
PORT: 3000
|
||||
MONGO_URI: "mongodb://mongo:27017/evaluetonsavoir"
|
||||
|
|
|
|||
30
server/config/auth.js
Normal file
30
server/config/auth.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
require('dotenv').config({ path: './.env.auth' });
|
||||
|
||||
module.exports = {
|
||||
// Activer ou désactiver les types d'authentifications
|
||||
simpleLoginActive: process.env.SIMPLE_LOGIN_ACTIVE === 'true',
|
||||
oauthActive: process.env.OAUTH_ACTIVE === 'true',
|
||||
oidcActive: process.env.OIDC_ACTIVE === 'true',
|
||||
|
||||
// Configuration Simple Login
|
||||
sessionSecret: process.env.SESSION_SECRET || 'default_session_secret',
|
||||
|
||||
// Configuration OAuth
|
||||
oauth: {
|
||||
authorizationURL: process.env.OAUTH_AUTHORIZATION_URL || '',
|
||||
tokenURL: process.env.OAUTH_TOKEN_URL || '',
|
||||
clientID: process.env.OAUTH_CLIENT_ID || '',
|
||||
clientSecret: process.env.OAUTH_CLIENT_SECRET || '',
|
||||
callbackURL: process.env.OAUTH_CALLBACK_URL || '',
|
||||
scope: process.env.OAUTH_ADD_SCOPE || '',
|
||||
teacherRoleClaim: process.env.OAUTH_ROLE_TEACHER_VALUE || '',
|
||||
},
|
||||
|
||||
// Configuration OIDC
|
||||
oidc: {
|
||||
clientID: process.env.OIDC_CLIENT_ID || '',
|
||||
clientSecret: process.env.OIDC_CLIENT_SECRET || '',
|
||||
issuerURL: process.env.OIDC_ISSUER_URL || '',
|
||||
callbackURL: process.env.OIDC_CALLBACK_URL || '',
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue