forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHardcodedCouchBaseCredentials.java
More file actions
35 lines (32 loc) · 1.51 KB
/
HardcodedCouchBaseCredentials.java
File metadata and controls
35 lines (32 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import static com.couchbase.client.java.ClusterOptions.clusterOptions;
import com.couchbase.client.core.env.Authenticator;
import com.couchbase.client.core.env.CertificateAuthenticator;
import com.couchbase.client.core.env.PasswordAuthenticator;
import com.couchbase.client.java.Cluster;
public class HardcodedCouchBaseCredentials {
public static void test() {
Cluster cluster1 =
Cluster.connect(
"127.0.0.1",
"Administrator", // $ HardcodedCredentialsApiCall $ HardcodedCredentialsSourceCall
"password"); // $ HardcodedCredentialsApiCall $ HardcodedCredentialsSourceCall
Cluster cluster2 =
Cluster.connect(
"127.0.0.1",
clusterOptions(
"Administrator", // $ HardcodedCredentialsApiCall $ HardcodedCredentialsSourceCall
"password")); // $ HardcodedCredentialsApiCall $ HardcodedCredentialsSourceCall
PasswordAuthenticator authenticator1 =
PasswordAuthenticator.builder()
.username(
"Administrator") // $ HardcodedCredentialsApiCall $ HardcodedCredentialsSourceCall
.password("password") // $ HardcodedCredentialsApiCall $ HardcodedCredentialsSourceCall
.onlyEnablePlainSaslMechanism()
.build();
Authenticator authenticator2 =
CertificateAuthenticator.fromKeyStore(
null,
"keyStorePassword"); // $ HardcodedCredentialsApiCall
Cluster cluster = Cluster.connect("127.0.0.1", clusterOptions(authenticator2));
}
}