Skip to content

Commit a93cc21

Browse files
authored
chore(server): remove outdated ConfigAuthenticator (#2927)
1 parent d641fdb commit a93cc21

File tree

10 files changed

+19
-191
lines changed

10 files changed

+19
-191
lines changed

docker/configs/server1-conf/rest-server.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ arthas.ip=127.0.0.1
1212
arthas.disabled_commands=jad
1313

1414
# authentication configs
15-
# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or
16-
# 'org.apache.hugegraph.auth.ConfigAuthenticator'
15+
# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or a custom implementation
1716
#auth.authenticator=
17+
# for admin password, By default, it is pa and takes effect upon the first startup
18+
#auth.admin_pa=pa
1819

1920
# rpc server configs for multi graph-servers or raft-servers
2021
rpc.server_host=127.0.0.1

docker/configs/server2-conf/rest-server.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ arthas.ip=127.0.0.1
1212
arthas.disabled_commands=jad
1313

1414
# authentication configs
15-
# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or
16-
# 'org.apache.hugegraph.auth.ConfigAuthenticator'
15+
# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or a custom implementation
1716
#auth.authenticator=
17+
# for admin password, By default, it is pa and takes effect upon the first startup
18+
#auth.admin_pa=pa
1819

1920
# rpc server configs for multi graph-servers or raft-servers
2021
rpc.server_host=127.0.0.1

docker/configs/server3-conf/rest-server.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ arthas.ip=127.0.0.1
1212
arthas.disabled_commands=jad
1313

1414
# authentication configs
15-
# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or
16-
# 'org.apache.hugegraph.auth.ConfigAuthenticator'
15+
# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or a custom implementation
1716
#auth.authenticator=
17+
# for admin password, By default, it is pa and takes effect upon the first startup
18+
#auth.admin_pa=pa
1819

1920
# rpc server configs for multi graph-servers or raft-servers
2021
rpc.server_host=127.0.0.1

hugegraph-cluster-test/hugegraph-clustertest-dist/src/assembly/static/conf/rest-server.properties.template

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,16 @@ arthas.ip=127.0.0.1
3434
arthas.disabled_commands=jad
3535

3636
# authentication configs
37-
# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or
38-
# 'org.apache.hugegraph.auth.ConfigAuthenticator'
37+
# choose 'org.apache.hugegraph.auth.StandardAuthenticator' or a custom implementation
3938
#auth.authenticator=
39+
# for admin password, By default, it is pa and takes effect upon the first startup
40+
#auth.admin_pa=pa
4041

4142
# for StandardAuthenticator mode
4243
#auth.graph_store=hugegraph
4344
# auth client config
4445
#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897
4546

46-
# for ConfigAuthenticator mode
47-
#auth.admin_token=
48-
#auth.user_tokens=[]
49-
5047
# rpc server configs for multi graph-servers or raft-servers
5148
rpc.server_host=127.0.0.1
5249
rpc.server_port=$RPC_PORT$

hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/ConfigAuthenticator.java

Lines changed: 0 additions & 111 deletions
This file was deleted.

hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/auth/HugeFactoryAuthProxy.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ private static void registerPrivateActions() {
129129
Reflection.registerFieldsToFilter(StandardAuthenticator.class, "graph");
130130
Reflection.registerMethodsToFilter(StandardAuthenticator.class, "initAdminUser",
131131
"inputPassword", "graph");
132-
Reflection.registerFieldsToFilter(ConfigAuthenticator.class, "tokens");
133132
Reflection.registerFieldsToFilter(HugeFactoryAuthProxy.class, "PROTECT_METHODS");
134133
Reflection.registerMethodsToFilter(HugeFactoryAuthProxy.class, "genRegisterPrivateActions",
135134
"registerClass", "registerPrivateActions",
@@ -508,7 +507,6 @@ private static void genRegisterPrivateActions() {
508507
registerPrivateActions(InheritableThreadLocal.class);
509508

510509
registerPrivateActions(StandardAuthenticator.class);
511-
registerPrivateActions(ConfigAuthenticator.class);
512510
registerPrivateActions(HugeFactoryAuthProxy.class);
513511
registerPrivateActions(HugeAuthenticator.User.class);
514512

hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/config/ServerOptions.java

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -462,40 +462,20 @@ public class ServerOptions extends OptionHolder {
462462
new ConfigOption<>(
463463
"auth.authenticator",
464464
"The class path of authenticator implementation. " +
465-
"e.g., org.apache.hugegraph.auth.StandardAuthenticator, " +
466-
"or org.apache.hugegraph.auth.ConfigAuthenticator.",
465+
"e.g., org.apache.hugegraph.auth.StandardAuthenticator.",
467466
null,
468467
""
469468
);
470469

471470
public static final ConfigOption<String> ADMIN_PA =
472471
new ConfigOption<>(
473472
"auth.admin_pa",
474-
"The class path of authenticator implementation. " +
475-
"e.g., org.apache.hugegraph.auth.StandardAuthenticator, " +
476-
"or org.apache.hugegraph.auth.ConfigAuthenticator.",
473+
"The default password for built-in admin account, " +
474+
"takes effect on first startup.",
477475
null,
478476
"pa"
479477
);
480478

481-
public static final ConfigOption<String> AUTH_ADMIN_TOKEN =
482-
new ConfigOption<>(
483-
"auth.admin_token",
484-
"Token for administrator operations, " +
485-
"only for org.apache.hugegraph.auth.ConfigAuthenticator.",
486-
disallowEmpty(),
487-
"162f7848-0b6d-4faf-b557-3a0797869c55"
488-
);
489-
490-
public static final ConfigListOption<String> AUTH_USER_TOKENS =
491-
new ConfigListOption<>(
492-
"auth.user_tokens",
493-
"The map of user tokens with name and password, " +
494-
"only for org.apache.hugegraph.auth.ConfigAuthenticator.",
495-
disallowEmpty(),
496-
"hugegraph:9fd95c9c-711b-415b-b85f-d4df46ba5c31"
497-
);
498-
499479
public static final ConfigOption<String> SSL_KEYSTORE_FILE =
500480
new ConfigOption<>(
501481
"ssl.keystore_file",

hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,9 +1611,9 @@ private void checkBackendVersionOrExit(HugeConfig config) {
16111611
if (!hugegraph.backendStoreFeatures().supportsPersistence()) {
16121612
hugegraph.initBackend();
16131613
if (this.requireAuthentication()) {
1614-
String token = config.get(ServerOptions.AUTH_ADMIN_TOKEN);
1614+
String adminPassword = config.get(ServerOptions.ADMIN_PA);
16151615
try {
1616-
this.authenticator().initAdminUser(token);
1616+
this.authenticator().initAdminUser(adminPassword);
16171617
} catch (Exception e) {
16181618
throw new BackendException(
16191619
"The backend store of '%s' can't " +

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/AuthOptions.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ public static synchronized AuthOptions instance() {
4444
new ConfigOption<>(
4545
"auth.authenticator",
4646
"The class path of authenticator implementation. " +
47-
"e.g., org.apache.hugegraph.auth.StandardAuthenticator, " +
48-
"or org.apache.hugegraph.auth.ConfigAuthenticator.",
47+
"e.g., org.apache.hugegraph.auth.StandardAuthenticator.",
4948
null,
5049
""
5150
);
@@ -59,24 +58,6 @@ public static synchronized AuthOptions instance() {
5958
"hugegraph"
6059
);
6160

62-
public static final ConfigOption<String> AUTH_ADMIN_TOKEN =
63-
new ConfigOption<>(
64-
"auth.admin_token",
65-
"Token for administrator operations, " +
66-
"only for org.apache.hugegraph.auth.ConfigAuthenticator.",
67-
disallowEmpty(),
68-
"162f7848-0b6d-4faf-b557-3a0797869c55"
69-
);
70-
71-
public static final ConfigListOption<String> AUTH_USER_TOKENS =
72-
new ConfigListOption<>(
73-
"auth.user_tokens",
74-
"The map of user tokens with name and password, " +
75-
"only for org.apache.hugegraph.auth.ConfigAuthenticator.",
76-
disallowEmpty(),
77-
"hugegraph:9fd95c9c-711b-415b-b85f-d4df46ba5c31"
78-
);
79-
8061
public static final ConfigOption<String> AUTH_REMOTE_URL =
8162
new ConfigOption<>(
8263
"auth.remote_url",

hugegraph-struct/src/main/java/org/apache/hugegraph/options/AuthOptions.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.apache.hugegraph.options;
2121

22-
import org.apache.hugegraph.config.ConfigListOption;
2322
import org.apache.hugegraph.config.ConfigOption;
2423
import org.apache.hugegraph.config.OptionHolder;
2524

@@ -82,8 +81,7 @@ public static synchronized AuthOptions instance() {
8281
new ConfigOption<>(
8382
"auth.authenticator",
8483
"The class path of authenticator implementation. " +
85-
"e.g., org.apache.hugegraph.auth.StandardAuthenticator, " +
86-
"or org.apache.hugegraph.auth.ConfigAuthenticator.",
84+
"e.g., org.apache.hugegraph.auth.StandardAuthenticator.",
8785
null,
8886
""
8987
);
@@ -97,24 +95,6 @@ public static synchronized AuthOptions instance() {
9795
"hugegraph"
9896
);
9997

100-
public static final ConfigOption<String> AUTH_ADMIN_TOKEN =
101-
new ConfigOption<>(
102-
"auth.admin_token",
103-
"Token for administrator operations, " +
104-
"only for org.apache.hugegraph.auth.ConfigAuthenticator.",
105-
disallowEmpty(),
106-
"162f7848-0b6d-4faf-b557-3a0797869c55"
107-
);
108-
109-
public static final ConfigListOption<String> AUTH_USER_TOKENS =
110-
new ConfigListOption<>(
111-
"auth.user_tokens",
112-
"The map of user tokens with name and password, " +
113-
"only for org.apache.hugegraph.auth.ConfigAuthenticator.",
114-
disallowEmpty(),
115-
"hugegraph:9fd95c9c-711b-415b-b85f-d4df46ba5c31"
116-
);
117-
11898
public static final ConfigOption<String> AUTH_REMOTE_URL =
11999
new ConfigOption<>(
120100
"auth.remote_url",

0 commit comments

Comments
 (0)