Skip to content

Commit b2dcb02

Browse files
committed
feat: include a new configuration token
Signed-off-by: Otavio Santana <[email protected]>
1 parent 7106b00 commit b2dcb02

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,24 @@ public Optional<AuthorizationProvider> apply(Settings settings) {
103103
public Optional<AuthorizationProvider> apply(Settings settings) {
104104
return Optional.of(SignatureProvider.createWithInstancePrincipalForDelegation(new File(System.getenv("OCI_obo_token_path"))));
105105
}
106+
},
107+
/**
108+
* Represents a "Cloud" deployment using resource principal for delegation with an OBO token.
109+
*/
110+
CLOUD_SECURITY_TOKEN {
111+
@Override
112+
public Optional<AuthorizationProvider> apply(Settings settings) {
113+
114+
String profileName = settings.get(OracleNoSQLConfigurations.PROFILE_NAME, String.class).orElse(null);
115+
String configFile = settings.get(OracleNoSQLConfigurations.CONFIG_FILE, String.class).orElse(null);
116+
if(profileName != null && configFile != null) {
117+
return Optional.of(SignatureProvider.createWithSessionToken(configFile, profileName));
118+
} else if(profileName != null) {
119+
return Optional.of(SignatureProvider.createWithSessionToken(profileName));
120+
} else {
121+
return Optional.of(SignatureProvider.createWithSessionToken());
122+
}
123+
}
106124
};
107125

108126

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,16 @@ public enum OracleNoSQLConfigurations implements Supplier<String> {
116116
/**
117117
* Define the compartment name in Oracle NoSQL on-premise.
118118
*/
119-
NAMESPACE("jnosql.oracle.nosql.namespace");
119+
NAMESPACE("jnosql.oracle.nosql.namespace"),
120+
121+
/**
122+
* Define the profile name used to load session token in Oracle NoSQL cloud.
123+
*/
124+
PROFILE_NAME("jnosql.oracle.nosql.profile.name"),
125+
/**
126+
* Define the path of configuration file used to load session token in Oracle NoSQL cloud.
127+
*/
128+
CONFIG_FILE("jnosql.oracle.nosql.config.file");
120129

121130

122131
private final String configuration;

0 commit comments

Comments
 (0)