Skip to content

Commit 43072e9

Browse files
committed
feat: implemnt validation to credential at profile and config at oracle nosql
Signed-off-by: Otavio Santana <[email protected]>
1 parent 2a3a080 commit 43072e9

File tree

1 file changed

+12
-1
lines changed
  • jnosql-nosql-oracle/src/main/java/org/eclipse/jnosql/databases/oracle/communication

1 file changed

+12
-1
lines changed

jnosql-nosql-oracle/src/main/java/org/eclipse/jnosql/databases/oracle/communication/DeploymentType.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,28 @@ public Optional<AuthorizationProvider> apply(Settings settings) {
6969
String tenantId = settings.get(OracleNoSQLConfigurations.TENANT, String.class).orElse(null);
7070
String fingerprint= settings.get(OracleNoSQLConfigurations.FINGERPRINT, String.class).orElse(null);
7171
String privateKey = settings.get(OracleNoSQLConfigurations.PRIVATE_KEY, String.class).orElse(null);
72+
String profileName = settings.get(OracleNoSQLConfigurations.PROFILE_NAME, String.class).orElse(null);
73+
String configFile = settings.get(OracleNoSQLConfigurations.CONFIG_FILE, String.class).orElse(null);
7274

73-
if(user != null && password.length > 0 && tenantId != null && fingerprint != null && privateKey != null) {
75+
if(isFingerPrint(user, password, tenantId, fingerprint, privateKey)) {
7476
return Optional.of(new SignatureProvider(tenantId, user, fingerprint, privateKey, password));
7577
}
7678
try {
79+
if(profileName != null && configFile != null) {
80+
return Optional.of(new SignatureProvider(configFile, profileName));
81+
} else if(profileName != null) {
82+
return Optional.of(new SignatureProvider(profileName));
83+
}
7784
return Optional.of(new SignatureProvider());
7885
} catch (IOException e) {
7986
throw new OracleNoSQLException("Error to load configuration to Oracle Cloud at Oracle NoSQL", e);
8087
}
8188

8289
}
90+
91+
private static boolean isFingerPrint(String user, char[] password, String tenantId, String fingerprint, String privateKey) {
92+
return user != null && password.length > 0 && tenantId != null && fingerprint != null && privateKey != null;
93+
}
8394
},
8495
/**
8596
* Represents a "Cloud" deployment using resource principal for authentication and authorization.

0 commit comments

Comments
 (0)