-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Improvement-16258][Registry] Add ZK authorization yaml control & add digest auth UT #16277
base: dev
Are you sure you want to change the base?
Conversation
d8dcb83
to
a2db653
Compare
.../java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistryProperties.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow pull request notice and fix code style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UT failed.
zk = new ZooKeeper("localhost:" + zookeeperContainer.getMappedPort(2181), | ||
30000, new DumbWatcher(), new ZKClientConfig()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why create ZooKeeper here?
public static void setupRootACLForDigest(final ZooKeeper zk) throws Exception { | ||
final String digest = DigestAuthenticationProvider.generateDigest(ID_PASSWORD); | ||
final ACL acl = new ACL(ZooDefs.Perms.ALL, new Id("digest", digest)); | ||
zk.setACL("/", Collections.singletonList(acl), -1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this method should be public?
zk.addAuthInfo("digest", ID_PASSWORD.getBytes(StandardCharsets.UTF_8)); | ||
resetRootACL(zk); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to reset?
@@ -80,7 +80,7 @@ final class ZookeeperRegistry implements Registry { | |||
.sessionTimeoutMs(DurationUtils.toMillisInt(properties.getSessionTimeout())) | |||
.connectionTimeoutMs(DurationUtils.toMillisInt(properties.getConnectionTimeout())); | |||
|
|||
final String digest = properties.getDigest(); | |||
final String digest = properties.getAuthorization().get(ZookeeperRegistryProperties.ZookeeperProperties.DIGEST); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we directly use the key as authorization key, value as authorization value ? otherwise you need to handle multiple authorization type.
Quality Gate passedIssues Measures |
d53076a
to
e4ee663
Compare
public enum ZookeeperAuthSchema { | ||
DIGEST, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing license, and can we removed this enum? We don't need to maintain a enum here.
if (properties.getAuthorization().size() > 0) { | ||
final String schema = properties.getAuthorization().keySet().stream().findFirst().get(); | ||
final String schemaValue = properties.getAuthorization().get(schema); | ||
builder.authorization(schema.toString().toLowerCase(), schemaValue.getBytes(StandardCharsets.UTF_8)) |
Check notice
Code scanning / CodeQL
Useless toString on String
…t auth UT Update dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistryProperties.java Co-authored-by: Wenjun Ruan <[email protected]>
…t auth UT
Purpose of the pull request
fix: Improvement
Brief change log
add digest UT and small refactor on ZK registry yaml for future authentication support like #16271 (comment)
Verify this pull request
Pull Request Notice
Pull Request Notice
If your pull request contain incompatible change, you should also add it to
docs/docs/en/guide/upgrede/incompatible.md