mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 16:53:58 +00:00
AD_ALLOWED_LOGINS support
This commit is contained in:
@@ -108,6 +108,12 @@ module.exports = {
|
|||||||
if (!res) {
|
if (!res) {
|
||||||
return { error: 'Login failed' };
|
return { error: 'Login failed' };
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
process.env.AD_ALLOWED_LOGINS &&
|
||||||
|
!process.env.AD_ALLOWED_LOGINS.split(',').find(x => x.toLowerCase().trim() == login.toLowerCase().trim())
|
||||||
|
) {
|
||||||
|
return { error: `Username ${login} not allowed to log in` };
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
accessToken: jwt.sign({ login }, tokenSecret, { expiresIn: getTokenLifetime() }),
|
accessToken: jwt.sign({ login }, tokenSecret, { expiresIn: getTokenLifetime() }),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user