Skip to content

Commit 26fb888

Browse files
authored
Merge pull request #294 from eclipse/include-oracle-nosql-deployment-type
Include new oracle nosql deployment type
2 parents 1dc95c1 + e7da0e0 commit 26fb888

File tree

1 file changed

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

1 file changed

+21
-12
lines changed

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public enum DeploymentType implements Function<Settings, Optional<AuthorizationP
3737
* Usage: Choose this deployment type when your software solutions are hosted and managed within your organization's physical infrastructure.
3838
* - Authentication: Uses username and password for access.
3939
* - Configuration: Requires USER (username) and PASSWORD (password).
40-
* If not provided, it falls back to default values or empty credentials.
40+
* If not provided, it falls back to default values or empty credentials.
4141
*/
4242
ON_PREMISES {
4343
@Override
@@ -47,7 +47,7 @@ public Optional<AuthorizationProvider> apply(Settings settings) {
4747
String password = settings.get(List.of(OracleNoSQLConfigurations.PASSWORD.get(), Configurations.PASSWORD.get()))
4848
.map(Object::toString).orElse(null);
4949
if (user != null && password != null) {
50-
return Optional.of(new StoreAccessTokenProvider(user, password.toCharArray()));
50+
return Optional.of(new StoreAccessTokenProvider(user, password.toCharArray()));
5151
} else {
5252
return Optional.of(new StoreAccessTokenProvider());
5353
}
@@ -67,18 +67,18 @@ public Optional<AuthorizationProvider> apply(Settings settings) {
6767
char[] password = settings.get(List.of(OracleNoSQLConfigurations.PASSWORD.get(), Configurations.PASSWORD.get()))
6868
.map(Object::toString).map(String::toCharArray).orElse(new char[0]);
6969
String tenantId = settings.get(OracleNoSQLConfigurations.TENANT, String.class).orElse(null);
70-
String fingerprint= settings.get(OracleNoSQLConfigurations.FINGERPRINT, String.class).orElse(null);
70+
String fingerprint = settings.get(OracleNoSQLConfigurations.FINGERPRINT, String.class).orElse(null);
7171
String privateKey = settings.get(OracleNoSQLConfigurations.PRIVATE_KEY, String.class).orElse(null);
7272
String profileName = settings.get(OracleNoSQLConfigurations.PROFILE_NAME, String.class).orElse(null);
7373
String configFile = settings.get(OracleNoSQLConfigurations.CONFIG_FILE, String.class).orElse(null);
7474

75-
if(user != null && tenantId != null && fingerprint != null && privateKey != null) {
75+
if (user != null && tenantId != null && fingerprint != null && privateKey != null) {
7676
return Optional.of(new SignatureProvider(tenantId, user, fingerprint, new File(privateKey), password));
7777
}
7878
try {
79-
if(profileName != null && configFile != null) {
79+
if (profileName != null && configFile != null) {
8080
return Optional.of(new SignatureProvider(configFile, profileName));
81-
} else if(profileName != null) {
81+
} else if (profileName != null) {
8282
return Optional.of(new SignatureProvider(profileName));
8383
}
8484
return Optional.of(new SignatureProvider());
@@ -125,14 +125,24 @@ public Optional<AuthorizationProvider> apply(Settings settings) {
125125

126126
String profileName = settings.get(OracleNoSQLConfigurations.PROFILE_NAME, String.class).orElse(null);
127127
String configFile = settings.get(OracleNoSQLConfigurations.CONFIG_FILE, String.class).orElse(null);
128-
if(profileName != null && configFile != null) {
128+
if (profileName != null && configFile != null) {
129129
return Optional.of(SignatureProvider.createWithSessionToken(configFile, profileName));
130-
} else if(profileName != null) {
130+
} else if (profileName != null) {
131131
return Optional.of(SignatureProvider.createWithSessionToken(profileName));
132-
} else {
132+
} else {
133133
return Optional.of(SignatureProvider.createWithSessionToken());
134134
}
135135
}
136+
},
137+
138+
/**
139+
* Represents a "Cloud" deployment using OKE workload identity for authentication and authorization.
140+
*/
141+
CLOUD_OKE_WORKLOAD_IDENTITY {
142+
@Override
143+
public Optional<AuthorizationProvider> apply(Settings settings) {
144+
return Optional.of(SignatureProvider.createWithOkeWorkloadIdentity());
145+
}
136146
};
137147

138148

@@ -142,12 +152,11 @@ public Optional<AuthorizationProvider> apply(Settings settings) {
142152
*
143153
* @param value the string representation of the deployment type (case-insensitive)
144154
* @return the corresponding {@link DeploymentType} enum value, or {@link DeploymentType#ON_PREMISES}
145-
* if the input is invalid or null
146-
*
155+
* if the input is invalid or null
147156
*/
148157
public static DeploymentType parse(String value) {
149158
try {
150-
if(value == null) {
159+
if (value == null) {
151160
return DeploymentType.ON_PREMISES;
152161
}
153162
return DeploymentType.valueOf(value.toUpperCase());

0 commit comments

Comments
 (0)