mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
Introduce an environment variable to allow JIT OIDC users creation based on their email address domain.
This commit is contained in:
@@ -37,6 +37,13 @@ const OIDCAuthenticationManager = {
|
||||
// (Is it safe? Concider: If an account from the specified provider is already linked to this user, throw an error)
|
||||
user = await User.findOne({ 'email': email }).exec()
|
||||
if (!user) {
|
||||
let allowedDomains = Settings.oidc.allowedOIDCEmailDomains;
|
||||
allowedDomains = allowedDomains.split(',').map(d => d.trim()); // Make sure it's an array
|
||||
const domain = email.split('@')[1];
|
||||
|
||||
if (!allowedDomains.includes(domain)) {
|
||||
return null;
|
||||
}
|
||||
if (Settings.oidc.disableJITAccountCreation) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ const OIDCModuleManager = {
|
||||
attUserId: process.env.OVERLEAF_OIDC_USER_ID_FIELD || 'id',
|
||||
attAdmin: process.env.OVERLEAF_OIDC_IS_ADMIN_FIELD,
|
||||
valAdmin: process.env.OVERLEAF_OIDC_IS_ADMIN_FIELD_VALUE,
|
||||
allowedOIDCEmailDomains: process.env.OVERLEAF_OIDC_ALLOWED_EMAIL_DOMAINS,
|
||||
updateUserDetailsOnLogin: boolFromEnv(process.env.OVERLEAF_OIDC_UPDATE_USER_DETAILS_ON_LOGIN),
|
||||
disableJITAccountCreation: boolFromEnv(process.env.OVERLEAF_OIDC_DISABLE_JIT_ACCOUNT_CREATION),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user