You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CuratorFramework interface doesn't have a method called addAuthInfo, and the code snippet also has @BootstrapConfiguration spelled incorrectly.
Furthermore I think the initial code snippet wouldn't work as it would override the standard implementation in spring cloud zookeeper rather than extending it.
What is the currently suggested way for adding authentication information? I can see the CuratorFrameworkImpl and CuratorFrameworkFactory now have variables called authInfos that's set through the builder by calling authorization(List authInfos).
Is the suggested/correct way to add authentication now to override the curatorFramework bean from the ZookeeperAutoConfiguration and add that option within the builder? Does this still have to happen at the Bootstrapping phase?
The functionality will be available after #244 adds a CuratorFrameworkFactory.Builder customizer has been added. There are then authorization() methods on the build. The docs will need to be updated when #244 is done.
I solved it by the following codes,the docs missed a 't' at @BootstrapConfiguration,maybe need to update the docs or pr?
I don't no why the codes can not display properly when using Add code option.
`
@BootstrapConfiguration
public class CustomCuratorFrameworkConfig {
@Autowired(required = false)
private EnsembleProvider ensembleProvider;
@Bean
public ZookeeperProperties zookeeperProperties() {
return new ZookeeperProperties();
}
@Bean
public CuratorFramework curatorFramework(RetryPolicy retryPolicy, ZookeeperProperties properties) throws Exception{
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder();
if (this.ensembleProvider != null) {
builder.ensembleProvider(this.ensembleProvider);
} else {
builder.connectString(properties.getConnectString());
}
builder.retryPolicy(retryPolicy);
String digestString = "user:password";
List<ACL> list = new ArrayList<>();
String digest = DigestAuthenticationProvider.generateDigest(digestString);
ACL acl = new ACL(ZooDefs.Perms.ALL, new Id("digest", digest));
list.add(acl);
builder.authorization("digest", digestString.getBytes())
.aclProvider(new ACLProvider() {
@Override
public List<ACL> getDefaultAcl() {
return list;
}
@Override
public List<ACL> getAclForPath(String path) {
return list;
}
});
CuratorFramework curator = builder.build();
curator.start();
curator.blockUntilConnected(properties.getBlockUntilConnectedWait(), properties.getBlockUntilConnectedUnit());
return curator;
}
@Bean
public RetryPolicy exponentialBackoffRetry(ZookeeperProperties properties) {
return new ExponentialBackoffRetry(properties.getBaseSleepTimeMs(), properties.getMaxRetries(), properties.getMaxSleepMs());
}
Activity
spencergibb commentedon Apr 8, 2020
The functionality will be available after #244 adds a
CuratorFrameworkFactory.Buildercustomizer has been added. There are thenauthorization()methods on the build. The docs will need to be updated when #244 is done.Alfred-Mountfield commentedon Apr 16, 2020
Sounds good. Looking at how the proposed changes could solve our problems, thanks
chingjustwe commentedon Sep 2, 2022
I still don't see the updated doc, can anybody share how to set ACL in new way?
chingjustwe commentedon Sep 2, 2022
@berngp can you explain how to use
CuratorFrameworkCustomizerplease? In my case,CuratorFrameworkalways created beforeCuratorFrameworkCustomizer.aofall commentedon Jun 9, 2023
Define the following configuration in the code.
The
StringUtilsclass from the commons-lang3 package, you can import from maven. The current final version is3.12.0nowAnd defined in
application.yml, if ACL authentication is not required, just keep the username and password empty.spencergibb commentedon Jul 13, 2023
Please stop commenting on multiple issues
WhiteStart commentedon Aug 16, 2023
I solved it by the following codes,the docs missed a 't' at @BootstrapConfiguration,maybe need to update the docs or pr?
I don't no why the codes can not display properly when using Add code option.
`
@BootstrapConfiguration
public class CustomCuratorFrameworkConfig {
}`
spring.factories
org.springframework.cloud.bootstrap.BootstrapConfiguration=\ com.example.registration.config.CustomCuratorFrameworkConfigbootstrap.yml
spring: cloud: zookeeper: connect-string: 127.0.0.1:2181 enabled: trueorg.springframework.cloud
spring-cloud-starter-bootstrap
`
AzazelSensei commentedon Sep 3, 2026
Opened #460 with the CuratorFrameworkCustomizer / authorization() docs Spencer mentioned after #244.
Merge pull request #460 from AzazelSensei/docs/acl-auth-customizer-239
Merge pull request #460 from AzazelSensei/docs/acl-auth-customizer-239
Fix ACL docs to use CuratorFrameworkCustomizer