Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajout de la prise en charge du ssl pour l'authentification ldaps #97

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions axelor-core/src/main/java/com/axelor/auth/AuthLdap.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.google.common.collect.Sets;
import com.google.inject.persist.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.UUID;
Expand Down Expand Up @@ -68,10 +69,15 @@ public class AuthLdap {

public static final String DEFAULT_AUTH_TYPE = "simple";

public static final String LDAP_USE_SSL = "ldap.use.ssl";
public static final String LDAP_USE_SSL_TRUE_VALUE = "true";

private String ldapServerUrl;

private String ldapAuthType;

private Boolean ldapUseSSL;

private String ldapSysUser;

private String ldapSysPassword;
Expand Down Expand Up @@ -105,12 +111,19 @@ public AuthLdap(@Named("auth.ldap.config") Properties properties, AuthService au
ldapGroupFilter = properties.getProperty(LDAP_GROUP_FILTER);
ldapUserFilter = properties.getProperty(LDAP_USER_FILTER);
ldapGroupObjectClass = properties.getProperty(LDAP_GROUP_OBJECT_CLASS);
ldapUseSSL = LDAP_USE_SSL_TRUE_VALUE.equals(properties.getProperty(LDAP_USE_SSL));

factory.setUrl(ldapServerUrl);
factory.setSystemUsername(ldapSysUser);
factory.setSystemPassword(ldapSysPassword);
factory.setAuthenticationMechanism(ldapAuthType);

if (ldapUseSSL) {
Map<String, Object> env = factory.getEnvironment();
env.put("java.naming.security.protocol", "ssl");
factory.setEnvironment(env);
}

this.authService = authService;
}

Expand Down