active auth simple login added

This commit is contained in:
MathieuSevignyLavallee 2024-09-24 22:08:48 -04:00
parent 9c10fbec69
commit 63769e9baf

View file

@ -133,14 +133,15 @@ 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 = {};
// 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] = {};
if (providerConfig.type === 'oauth') {
@ -157,13 +158,23 @@ class AuthConfig {
};
}
});
}
// 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