mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
active auth simple login added
This commit is contained in:
parent
9c10fbec69
commit
63769e9baf
1 changed files with 32 additions and 21 deletions
|
|
@ -133,37 +133,48 @@ class AuthConfig {
|
|||
|
||||
// Méthode pour retourner la configuration des fournisseurs PassportJS pour le frontend
|
||||
getActiveAuth() {
|
||||
if (this.config && this.config.auth && this.config.auth.passportjs) {
|
||||
if (this.config && this.config.auth) {
|
||||
const passportConfig = {};
|
||||
|
||||
this.config.auth.passportjs.forEach(provider => {
|
||||
const providerName = Object.keys(provider)[0];
|
||||
const providerConfig = provider[providerName];
|
||||
// Gestion des providers PassportJS
|
||||
if (this.config.auth.passportjs) {
|
||||
this.config.auth.passportjs.forEach(provider => {
|
||||
const providerName = Object.keys(provider)[0];
|
||||
const providerConfig = provider[providerName];
|
||||
|
||||
// On inclut uniquement les champs nécessaires pour le frontend
|
||||
passportConfig[providerName] = {};
|
||||
passportConfig[providerName] = {};
|
||||
|
||||
if (providerConfig.type === 'oauth') {
|
||||
passportConfig[providerName] = {
|
||||
type: providerConfig.type,
|
||||
authorizationUrl: providerConfig.OAUTH_AUTHORIZATION_URL,
|
||||
callbackUrl: providerConfig.OAUTH_CALLBACK_URL,
|
||||
};
|
||||
} else if (providerConfig.type === 'oidc') {
|
||||
passportConfig[providerName] = {
|
||||
type: providerConfig.type,
|
||||
issuerUrl: providerConfig.OIDC_ISSUER_URL,
|
||||
callbackUrl: providerConfig.OIDC_CALLBACK_URL
|
||||
};
|
||||
}
|
||||
});
|
||||
if (providerConfig.type === 'oauth') {
|
||||
passportConfig[providerName] = {
|
||||
type: providerConfig.type,
|
||||
authorizationUrl: providerConfig.OAUTH_AUTHORIZATION_URL,
|
||||
callbackUrl: providerConfig.OAUTH_CALLBACK_URL,
|
||||
};
|
||||
} else if (providerConfig.type === 'oidc') {
|
||||
passportConfig[providerName] = {
|
||||
type: providerConfig.type,
|
||||
issuerUrl: providerConfig.OIDC_ISSUER_URL,
|
||||
callbackUrl: providerConfig.OIDC_CALLBACK_URL
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Gestion du Simple Login
|
||||
if (this.config.auth["simple-login"] && this.config.auth["simple-login"].enabled) {
|
||||
passportConfig['simple-login'] = {
|
||||
type: "simple-login",
|
||||
name: this.config.auth["simple-login"].name
|
||||
};
|
||||
}
|
||||
|
||||
return passportConfig;
|
||||
} else {
|
||||
return { error: "Aucune configuration PassportJS disponible." };
|
||||
return { error: "Aucune configuration d'authentification disponible." };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Utilisation de la classe ConfigManager
|
||||
|
|
|
|||
Loading…
Reference in a new issue