KON-13 ldap in localdev yml
diff --git a/src/main/asciidoc/architectureDocumentation/architectureDocumentation.adoc b/src/main/asciidoc/architectureDocumentation/architectureDocumentation.adoc
index 313b619..6a79087 100644
--- a/src/main/asciidoc/architectureDocumentation/architectureDocumentation.adoc
+++ b/src/main/asciidoc/architectureDocumentation/architectureDocumentation.adoc
@@ -733,6 +733,8 @@
like the Auth'n'Auth-Modul, because the token will be out of date)
* *authNAuthService.ribbon.listOfServers* Here one can configure the base
url to the Auth'n'Auth-Service
+* *ldap.enabled* If set to "true" the ldap functionality will be enabled
+* *ldap.scheduling.enabled* (true or false) swtiches the ldap synchronisation on/off
=== CI- and CD-Components
diff --git a/src/main/java/org/eclipse/openk/contactbasedata/service/LdapService.java b/src/main/java/org/eclipse/openk/contactbasedata/service/LdapService.java
index 8636830..8df334a 100644
--- a/src/main/java/org/eclipse/openk/contactbasedata/service/LdapService.java
+++ b/src/main/java/org/eclipse/openk/contactbasedata/service/LdapService.java
@@ -1,4 +1,5 @@
package org.eclipse.openk.contactbasedata.service;
+
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang.StringUtils;
import org.eclipse.openk.contactbasedata.exceptions.NotFoundException;
@@ -26,6 +27,9 @@
@Service
public class LdapService {
+ @Value("${ldap.enabled}")
+ private Boolean ldapEnabled;
+
@Value("${ldap.attribute-mapping.uid}")
private String uid;
@@ -55,8 +59,9 @@
* @return list of LdapUsers
*/
public List<LdapUser> getAllLdapUsers() {
- return ldapTemplate.search(query()
- .where("objectclass").is("person"), ldapUserAttributesMapper);
+ return ldapEnabled.booleanValue()
+ ? ldapTemplate.search(query().where("objectclass").is("person"), ldapUserAttributesMapper)
+ : new ArrayList<>();
}
/**
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 9029383..65691af 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -25,6 +25,7 @@
urls: ldap://entopkon:10389
ldap:
+ enabled: true
attribute-mapping:
uid: uid
fullname: cn
@@ -83,6 +84,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fe4bKbAiPAyY2x5YbAf3M4eXnLrGqo8-loGKldICC28bL0LaMA3KKkQEOfW5sfpGqoN6212vs89mOklt0TJYc5PMXwFgJ5WC_TKjdwq7-aaDafOEWehV0U1ut3s-94ovNYIEn29nzXm2W1ldoXJEq03F880jlysQ5zlRvGF7eXEEpFfI2URyyNQ2UWh0Ssfq-gOAt2pbF1u6prA5RfvUmZ3v1eu21YLGZtgqPqxb1l6odyH3ip15j_HdgnTeo52ymxuRUj65Mskme3V5ev2DitHI9vZgnpV8Idhb4TTWliBeGCOMfDFCg
+
+ldap:
+ enabled: true
+
server:
port: 9155
@@ -113,6 +121,10 @@
spring:
profiles: devserver
+
+ldap:
+ enabled: true
+
jwt:
tokenHeader: Authorization
useStaticJwt: false
@@ -130,6 +142,9 @@
spring:
profiles: devserver-unsecure
+ldap:
+ enabled: true
+
jwt:
tokenHeader: Authorization
useStaticJwt: true
@@ -152,6 +167,9 @@
flyway:
enabled: false
+ldap:
+ enabled: false
+
server:
port: 9155
max-http-header-size: 262144
diff --git a/src/main/resources/application_localdev.yml b/src/main/resources/application_localdev.yml
index c699abf..870b286 100644
--- a/src/main/resources/application_localdev.yml
+++ b/src/main/resources/application_localdev.yml
@@ -25,6 +25,24 @@
session:
tracking-modes: cookie
+ldap:
+ enabled: false
+ attribute-mapping:
+ uid: uid
+ fullname: cn
+ lastname: sn
+ firstname: givenname
+ title: title
+ mail: mail
+ department: department
+ telephone-number: phone
+ db-id-mapping:
+ mail-id: 1
+ telephone-number-id: 2
+ scheduling:
+ enabled: false
+ cron-expression: '*/10 * * * * *'
+
jwt:
tokenHeader: Authorization
useStaticJwt: true