QinHaiqi commented on a change in pull request #2746:
URL: https://github.com/apache/incubator-shenyu/pull/2746#discussion_r782675547
##########
File path:
shenyu-admin/src/main/java/org/apache/shenyu/admin/config/LdapConfiguration.java
##########
@@ -47,17 +48,19 @@
@Bean
@ConditionalOnMissingBean
public LdapContextSource contextSource(final LdapProperties ldapProp) {
- LdapContextSource contextSource = new LdapContextSource();
- contextSource.setUrl(ldapProp.getUrl());
- contextSource.setUserDn(ldapProp.getBindDn());
- contextSource.setPassword(ldapProp.getPassword());
- contextSource.setPooled(true);
- Map<String, Object> config = new HashMap<>();
- config.put("java.naming.ldap.attributes.binary", "objectGUID");
- config.put("com.sun.jndi.ldap.connect.timeout",
String.valueOf(ldapProp.getConnectTimeout()));
- config.put("com.sun.jndi.ldap.read.timeout",
String.valueOf(ldapProp.getReadTimeout()));
- contextSource.setBaseEnvironmentProperties(config);
- return contextSource;
+ return Optional.ofNullable(ldapProp).map(item -> {
Review comment:
I don't understand the function of this annotation. I've learned it now.
Thank you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]