mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-06 09:19:19 +00:00
Start building against Spring LDAP 4.1.0-M1 snapshots
See gh-49119
This commit is contained in:
+5
-3
@@ -244,9 +244,11 @@ public final class EmbeddedLdapAutoConfiguration implements DisposableBean {
|
|||||||
EmbeddedLdapProperties embeddedProperties) {
|
EmbeddedLdapProperties embeddedProperties) {
|
||||||
LdapContextSource source = new LdapContextSource();
|
LdapContextSource source = new LdapContextSource();
|
||||||
source.setBase(properties.getBase());
|
source.setBase(properties.getBase());
|
||||||
if (embeddedProperties.getCredential().isAvailable()) {
|
String username = embeddedProperties.getCredential().getUsername();
|
||||||
source.setUserDn(embeddedProperties.getCredential().getUsername());
|
String password = embeddedProperties.getCredential().getPassword();
|
||||||
source.setPassword(embeddedProperties.getCredential().getPassword());
|
if (StringUtils.hasText(username) && StringUtils.hasText(password)) {
|
||||||
|
source.setUserDn(username);
|
||||||
|
source.setPassword(password);
|
||||||
}
|
}
|
||||||
source.setUrls(properties.determineUrls(environment));
|
source.setUrls(properties.determineUrls(environment));
|
||||||
return source;
|
return source;
|
||||||
|
|||||||
-5
@@ -24,7 +24,6 @@ import org.jspecify.annotations.Nullable;
|
|||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.boot.convert.Delimiter;
|
import org.springframework.boot.convert.Delimiter;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration properties for Embedded LDAP.
|
* Configuration properties for Embedded LDAP.
|
||||||
@@ -135,10 +134,6 @@ public class EmbeddedLdapProperties {
|
|||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isAvailable() {
|
|
||||||
return StringUtils.hasText(this.username) && StringUtils.hasText(this.password);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Ssl {
|
public static class Ssl {
|
||||||
|
|||||||
+5
-3
@@ -37,7 +37,7 @@ import org.springframework.util.Assert;
|
|||||||
*/
|
*/
|
||||||
public class LdapHealthIndicator extends AbstractHealthIndicator {
|
public class LdapHealthIndicator extends AbstractHealthIndicator {
|
||||||
|
|
||||||
private static final ContextExecutor<String> versionContextExecutor = new VersionContextExecutor();
|
private static final ContextExecutor<@Nullable String> versionContextExecutor = new VersionContextExecutor();
|
||||||
|
|
||||||
private final LdapOperations ldapOperations;
|
private final LdapOperations ldapOperations;
|
||||||
|
|
||||||
@@ -50,10 +50,12 @@ public class LdapHealthIndicator extends AbstractHealthIndicator {
|
|||||||
@Override
|
@Override
|
||||||
protected void doHealthCheck(Health.Builder builder) throws Exception {
|
protected void doHealthCheck(Health.Builder builder) throws Exception {
|
||||||
String version = this.ldapOperations.executeReadOnly(versionContextExecutor);
|
String version = this.ldapOperations.executeReadOnly(versionContextExecutor);
|
||||||
builder.up().withDetail("version", version);
|
if (version != null) {
|
||||||
|
builder.up().withDetail("version", version);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class VersionContextExecutor implements ContextExecutor<String> {
|
private static final class VersionContextExecutor implements ContextExecutor<@Nullable String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable String executeWithContext(DirContext ctx) throws NamingException {
|
public @Nullable String executeWithContext(DirContext ctx) throws NamingException {
|
||||||
|
|||||||
+1
-3
@@ -272,9 +272,7 @@ class LdapAutoConfigurationTests {
|
|||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
PooledContextSource pooledContextSource(LdapContextSource ldapContextSource) {
|
PooledContextSource pooledContextSource(LdapContextSource ldapContextSource) {
|
||||||
PooledContextSource pooledContextSource = new PooledContextSource(new PoolConfig());
|
return new PooledContextSource(ldapContextSource, new PoolConfig());
|
||||||
pooledContextSource.setContextSource(ldapContextSource);
|
|
||||||
return pooledContextSource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2549,7 +2549,7 @@ bom {
|
|||||||
releaseNotes("https://github.com/spring-projects/spring-kafka/releases/tag/v{version}")
|
releaseNotes("https://github.com/spring-projects/spring-kafka/releases/tag/v{version}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
library("Spring LDAP", "4.0.1") {
|
library("Spring LDAP", "4.1.0-SNAPSHOT") {
|
||||||
considerSnapshots()
|
considerSnapshots()
|
||||||
group("org.springframework.ldap") {
|
group("org.springframework.ldap") {
|
||||||
modules = [
|
modules = [
|
||||||
|
|||||||
Reference in New Issue
Block a user