Flaugh24 commented on code in PR #1821:
URL: https://github.com/apache/ignite-3/pull/1821#discussion_r1149697522
##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/call/cluster/ClusterInitCallInput.java:
##########
@@ -110,14 +132,37 @@ public ClusterInitCallInputBuilder clusterUrl(String
clusterUrl) {
* @return this builder
*/
public ClusterInitCallInputBuilder
fromClusterInitOptions(ClusterInitOptions clusterInitOptions) {
- this.metaStorageNodes = clusterInitOptions.getMetaStorageNodes();
- this.cmgNodes = clusterInitOptions.getCmgNodes();
- this.clusterName = clusterInitOptions.getClusterName();
+ this.metaStorageNodes = clusterInitOptions.metaStorageNodes();
+ this.cmgNodes = clusterInitOptions.cmgNodes();
+ this.clusterName = clusterInitOptions.clusterName();
+ this.authenticationSettings =
toAuthenticationConfig(clusterInitOptions.authenticationOptions());
return this;
}
public ClusterInitCallInput build() {
- return new ClusterInitCallInput(clusterUrl, metaStorageNodes,
cmgNodes, clusterName);
+ return new ClusterInitCallInput(clusterUrl, metaStorageNodes,
cmgNodes, clusterName, authenticationSettings);
+ }
+
+ private AuthenticationConfig
toAuthenticationConfig(AuthenticationOptions options) {
+ if (options == null) {
+ return null;
+ }
+
+ return new AuthenticationConfig(options.enabled(),
extractAuthenticationProviders(options));
+ }
+
+ private List<AuthenticationProviderConfig>
extractAuthenticationProviders(AuthenticationOptions options) {
+ return Stream.of(extractBasicAuthenticationProviderConfig(options))
+ .filter(Objects::nonNull)
+ .collect(Collectors.toList());
+ }
+
+ private BasicAuthenticationProviderConfig
extractBasicAuthenticationProviderConfig(AuthenticationOptions options) {
+ if (!nullOrBlank(options.basicLogin()) &&
!nullOrBlank(options.basicPassword())) {
+ return new BasicAuthenticationProviderConfig("basic",
options.basicLogin(), options.basicPassword());
+ } else {
+ return null;
+ }
Review Comment:
done
##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/call/cluster/ClusterInitCallInput.java:
##########
@@ -110,14 +132,37 @@ public ClusterInitCallInputBuilder clusterUrl(String
clusterUrl) {
* @return this builder
*/
public ClusterInitCallInputBuilder
fromClusterInitOptions(ClusterInitOptions clusterInitOptions) {
- this.metaStorageNodes = clusterInitOptions.getMetaStorageNodes();
- this.cmgNodes = clusterInitOptions.getCmgNodes();
- this.clusterName = clusterInitOptions.getClusterName();
+ this.metaStorageNodes = clusterInitOptions.metaStorageNodes();
+ this.cmgNodes = clusterInitOptions.cmgNodes();
+ this.clusterName = clusterInitOptions.clusterName();
+ this.authenticationSettings =
toAuthenticationConfig(clusterInitOptions.authenticationOptions());
Review Comment:
done
--
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]