Commit 22341041 authored by Tom Käsler's avatar Tom Käsler

Merge branch 'ldap-connect-timeout' into 'master'

Add config property for LDAP connect timeout

See merge request arsnova/arsnova-backend!185
parents 75d7dc76 c78c0c84
......@@ -19,6 +19,7 @@
package de.thm.arsnova.config;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.servlet.ServletContext;
......@@ -412,6 +413,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
final AuthenticationProviderProperties.Ldap ldapProperties = providerProperties.getLdap().get(0);
final DefaultSpringSecurityContextSource contextSource =
new DefaultSpringSecurityContextSource(ldapProperties.getHostUrl());
contextSource.setBaseEnvironmentProperties(Collections.singletonMap(
"com.sun.jndi.ldap.connect.timeout", String.valueOf(ldapProperties.getConnectTimeout())));
/* TODO: implement support for LDAP bind using manager credentials */
if (!"".equals(ldapProperties.getManagerUserDn()) && !"".equals(ldapProperties.getManagerPassword())) {
logger.debug("ldapManagerUserDn: {}", ldapProperties.getManagerUserDn());
......
......@@ -132,6 +132,7 @@ public class AuthenticationProviderProperties {
private String userSearchBase;
private String managerUserDn;
private String managerPassword;
private int connectTimeout;
public String getHostUrl() {
return hostUrl;
......@@ -188,6 +189,14 @@ public class AuthenticationProviderProperties {
public void setManagerPassword(final String managerPassword) {
this.managerPassword = managerPassword;
}
public int getConnectTimeout() {
return connectTimeout;
}
public void setConnectTimeout(final int connectTimeout) {
this.connectTimeout = connectTimeout;
}
}
public static class Oidc extends Provider {
......
......@@ -159,6 +159,8 @@ arsnova:
# Configure the LDAP manager user if anonymous binding is not allowed
manager-user-dn: cn=arsnova-manager,dc=example,dc=com
manager-password: arsnova
# Timeout for establishing a connection in milliseconds
connect-timeout: 5000
# SAML authentication
saml:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment