diff --git a/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/configuration/OciVaultJsonProvider.java b/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/configuration/OciVaultJsonProvider.java
index 81df1906..0055e18a 100644
--- a/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/configuration/OciVaultJsonProvider.java
+++ b/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/configuration/OciVaultJsonProvider.java
@@ -1,7 +1,6 @@
package oracle.jdbc.provider.oci.configuration;
import oracle.jdbc.driver.configuration.OracleConfigurationParsableProvider;
-import oracle.jdbc.provider.oci.vault.SecretBundleFactory;
import oracle.jdbc.provider.oci.vault.SecretFactory;
import oracle.jdbc.provider.parameter.ParameterSet;
import oracle.jdbc.util.OracleConfigurationCache;
@@ -12,15 +11,12 @@
import java.util.HashMap;
import java.util.Map;
-import static java.util.Objects.requireNonNull;
-
/**
* A provider for JSON payload which contains configuration from OCI Vault.
* See {@link #getInputStream(String)} for the spec of the JSON payload.
**/
public class OciVaultJsonProvider extends OracleConfigurationParsableProvider {
- private String secretName;
private static final OracleConfigurationCache CACHE = OracleConfigurationCache.create(100);
/**
@@ -45,14 +41,8 @@ public InputStream getInputStream(String secretOcid) {
OciConfigurationParameters.getParser()
.parseNamedValues(optionsWithOcid);
- // Get secret name
- secretName = SecretFactory.getInstance()
- .request(parameters)
- .getContent()
- .getName();
-
// Get secret contents
- String secretContent = SecretBundleFactory.getInstance()
+ String secretContent = SecretFactory.getInstance()
.request(parameters)
.getContent()
.getBase64Secret();
diff --git a/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/configuration/OciVaultSecretProvider.java b/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/configuration/OciVaultSecretProvider.java
index ab190214..3ff2e0fa 100644
--- a/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/configuration/OciVaultSecretProvider.java
+++ b/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/configuration/OciVaultSecretProvider.java
@@ -38,8 +38,8 @@
package oracle.jdbc.provider.oci.configuration;
-import oracle.jdbc.provider.oci.vault.SecretBundle;
-import oracle.jdbc.provider.oci.vault.SecretBundleFactory;
+import oracle.jdbc.provider.oci.vault.Secret;
+import oracle.jdbc.provider.oci.vault.SecretFactory;
import oracle.jdbc.provider.parameter.ParameterSet;
import oracle.jdbc.spi.OracleConfigurationSecretProvider;
@@ -67,7 +67,7 @@ public final class OciVaultSecretProvider
* }
* }
*
- * @param secretJsonObject json object to be parsed
+ * @param secretMap A map object to be parsed
* @return encoded char array in base64 format that represents the retrieved
* Secret.
*/
@@ -77,7 +77,7 @@ public char[] getSecret(Map
* A provider of passwords from the OCI Vault service.
diff --git a/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/resource/VaultUsernameProvider.java b/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/resource/VaultUsernameProvider.java
index bfe8d265..cb527762 100644
--- a/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/resource/VaultUsernameProvider.java
+++ b/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/resource/VaultUsernameProvider.java
@@ -38,9 +38,6 @@
package oracle.jdbc.provider.oci.resource;
import oracle.jdbc.provider.oci.vault.Secret;
-import oracle.jdbc.provider.oci.OciResourceParameter;
-import oracle.jdbc.provider.oci.vault.SecretBundleFactory;
-import oracle.jdbc.provider.parameter.ParameterSet;
import oracle.jdbc.provider.resource.ResourceParameter;
import oracle.jdbc.spi.UsernameProvider;
diff --git a/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/vault/Secret.java b/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/vault/Secret.java
index cba18bfd..88a87602 100644
--- a/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/vault/Secret.java
+++ b/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/vault/Secret.java
@@ -38,25 +38,77 @@
package oracle.jdbc.provider.oci.vault;
+import com.oracle.bmc.secrets.model.Base64SecretBundleContentDetails;
+import com.oracle.bmc.secrets.model.SecretBundle;
+import com.oracle.bmc.secrets.model.SecretBundleContentDetails;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.util.Arrays;
+import java.util.Base64;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
/**
* A secret managed by the OCI Vault service.
*/
public final class Secret {
- private final String name;
+ private final String base64Secret;
- private Secret(String name) {
- this.name = name;
+ private Secret(String base64Secret) {
+ this.base64Secret = base64Secret;
}
- static Secret fromSecret(com.oracle.bmc.vault.model.Secret secret) {
- return new Secret(secret.getSecretName());
+ static Secret fromSecretBundle(SecretBundle secretBundle) {
+
+ SecretBundleContentDetails secretBundleContentDetails =
+ secretBundle.getSecretBundleContent();
+
+ if (secretBundleContentDetails instanceof
+ Base64SecretBundleContentDetails) {
+
+ String base64Secret =
+ ((Base64SecretBundleContentDetails)secretBundleContentDetails)
+ .getContent();
+
+ return new Secret(base64Secret);
+ }
+ else {
+ throw new IllegalStateException(
+ "Unsupported content type: " + secretBundleContentDetails.getClass());
+ }
+ }
+
+ /**
+ * Returns the secret decoded as UTF-8 characters. The {@code char[]} returned
+ * by this method is not retained: It's contents may be wiped from memory
+ * after it has been consumed.
+ * @return Characters representing the UTF-8 decoding of the secret. Not null.
+ */
+ public char[] toCharArray() {
+ byte[] contentBytes = Base64.getDecoder().decode(base64Secret);
+ try {
+ CharBuffer contentBuffer = UTF_8.decode(ByteBuffer.wrap(contentBytes));
+ char[] contentChars = new char[contentBuffer.remaining()];
+ try {
+ contentBuffer.get(contentChars);
+ return contentChars;
+ }
+ finally {
+ contentBuffer.clear();
+ contentBuffer.put(new char[contentBuffer.capacity()]);
+ }
+ }
+ finally {
+ Arrays.fill(contentBytes, (byte)0);
+ }
}
/**
- * @return String that represents name of the Secret
+ * @return String that represents the Secret in base64 format
*/
- public String getName() {
- return name;
+ public String getBase64Secret() {
+ return base64Secret;
}
}
diff --git a/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/vault/SecretBundle.java b/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/vault/SecretBundle.java
deleted file mode 100644
index 588dd07e..00000000
--- a/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/vault/SecretBundle.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- ** Copyright (c) 2023 Oracle and/or its affiliates.
- **
- ** The Universal Permissive License (UPL), Version 1.0
- **
- ** Subject to the condition set forth below, permission is hereby granted to any
- ** person obtaining a copy of this software, associated documentation and/or data
- ** (collectively the "Software"), free of charge and under any and all copyright
- ** rights in the Software, and any and all patent rights owned or freely
- ** licensable by each licensor hereunder covering either (i) the unmodified
- ** Software as contributed to or provided by such licensor, or (ii) the Larger
- ** Works (as defined below), to deal in both
- **
- ** (a) the Software, and
- ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
- ** one is included with the Software (each a "Larger Work" to which the Software
- ** is contributed by such licensors),
- **
- ** without restriction, including without limitation the rights to copy, create
- ** derivative works of, display, perform, and distribute the Software and make,
- ** use, sell, offer for sale, import, export, have made, and have sold the
- ** Software and the Larger Work(s), and to sublicense the foregoing rights on
- ** either these or other terms.
- **
- ** This license is subject to the following condition:
- ** The above copyright notice and either this complete permission notice or at
- ** a minimum a reference to the UPL must be included in all copies or
- ** substantial portions of the Software.
- **
- ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- ** SOFTWARE.
- */
-
-package oracle.jdbc.provider.oci.vault;
-
-import com.oracle.bmc.secrets.model.Base64SecretBundleContentDetails;
-import com.oracle.bmc.secrets.model.SecretBundleContentDetails;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.util.Arrays;
-import java.util.Base64;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-/**
- * A secret managed by the OCI Vault service.
- */
-public final class SecretBundle {
-
- private final String base64Secret;
-
- private SecretBundle(String base64Secret) {
- this.base64Secret = base64Secret;
- }
-
- static SecretBundle fromSecretBundle(com.oracle.bmc.secrets.model.SecretBundle secretBundle) {
-
- SecretBundleContentDetails secretBundleContentDetails =
- secretBundle.getSecretBundleContent();
-
- if (secretBundleContentDetails instanceof
- Base64SecretBundleContentDetails) {
-
- String base64Secret =
- ((Base64SecretBundleContentDetails)secretBundleContentDetails)
- .getContent();
-
- return new SecretBundle(base64Secret);
- }
- else {
- throw new IllegalStateException(
- "Unsupported content type: " + secretBundleContentDetails.getClass());
- }
- }
-
- /**
- * Returns the secret decoded as UTF-8 characters. The {@code char[]} returned
- * by this method is not retained: It's contents may be wiped from memory
- * after it has been consumed.
- * @return Characters representing the UTF-8 decoding of the secret. Not null.
- */
- public char[] toCharArray() {
- byte[] contentBytes = Base64.getDecoder().decode(base64Secret);
- try {
- CharBuffer contentBuffer = UTF_8.decode(ByteBuffer.wrap(contentBytes));
- char[] contentChars = new char[contentBuffer.remaining()];
- try {
- contentBuffer.get(contentChars);
- return contentChars;
- }
- finally {
- contentBuffer.clear();
- contentBuffer.put(new char[contentBuffer.capacity()]);
- }
- }
- finally {
- Arrays.fill(contentBytes, (byte)0);
- }
- }
-
- /**
- * @return String that represents the Secret in base64 format
- */
- public String getBase64Secret() {
- return base64Secret;
- }
-}
diff --git a/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/vault/SecretBundleFactory.java b/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/vault/SecretBundleFactory.java
deleted file mode 100644
index deeb96fa..00000000
--- a/ojdbc-provider-oci/src/main/java/oracle/jdbc/provider/oci/vault/SecretBundleFactory.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- ** Copyright (c) 2023 Oracle and/or its affiliates.
- **
- ** The Universal Permissive License (UPL), Version 1.0
- **
- ** Subject to the condition set forth below, permission is hereby granted to any
- ** person obtaining a copy of this software, associated documentation and/or data
- ** (collectively the "Software"), free of charge and under any and all copyright
- ** rights in the Software, and any and all patent rights owned or freely
- ** licensable by each licensor hereunder covering either (i) the unmodified
- ** Software as contributed to or provided by such licensor, or (ii) the Larger
- ** Works (as defined below), to deal in both
- **
- ** (a) the Software, and
- ** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
- ** one is included with the Software (each a "Larger Work" to which the Software
- ** is contributed by such licensors),
- **
- ** without restriction, including without limitation the rights to copy, create
- ** derivative works of, display, perform, and distribute the Software and make,
- ** use, sell, offer for sale, import, export, have made, and have sold the
- ** Software and the Larger Work(s), and to sublicense the foregoing rights on
- ** either these or other terms.
- **
- ** This license is subject to the following condition:
- ** The above copyright notice and either this complete permission notice or at
- ** a minimum a reference to the UPL must be included in all copies or
- ** substantial portions of the Software.
- **
- ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- ** SOFTWARE.
- */
-
-package oracle.jdbc.provider.oci.vault;
-
-import com.oracle.bmc.Region;
-import com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider;
-import com.oracle.bmc.secrets.SecretsClient;
-import com.oracle.bmc.secrets.requests.GetSecretBundleRequest;
-import oracle.jdbc.provider.cache.CachedResourceFactory;
-import oracle.jdbc.provider.factory.ResourceFactory;
-import oracle.jdbc.provider.oci.OciResourceFactory;
-import oracle.jdbc.provider.oci.OciResourceParameter;
-import oracle.jdbc.provider.oci.Ocid;
-import oracle.jdbc.provider.parameter.ParameterSet;
-import oracle.jdbc.provider.factory.Resource;
-
-import java.time.OffsetDateTime;
-import java.time.ZoneOffset;
-import java.util.Date;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- *
- * Factory for requesting secrets from the Vault service. Secrets are
- * represented as {@link SecretBundle} objects. Oracle JDBC can use the content of
- * a secret as a database password, or any other security sensitive value.
- *
- * Requests the content of a secret bundle from the Vault service. The
- * {@code parameterSet} is required to include an {@link OciResourceParameter#OCID}.
- *
- * ocid1.
- * @see Resource Identifiers
- * @param ocid OCID of the regional resource
- * @return an {@code Region} which is extracted from the {@code ocid}
- */
- private Region parseRegion(String ocid) {
- String regex = "ocid1\\.[^.]+\\.[^.]+\\.([^.]+)\\..+";
- Pattern pattern = Pattern.compile(regex);
- Matcher matcher = pattern.matcher(ocid);
- if (matcher.matches()) {
- return Region.fromRegionCode(matcher.group(1));
- }
- throw new IllegalStateException(
- "Fail to parse region from the Secret OCID: " + ocid);
- }
-
-}
diff --git a/ojdbc-provider-opentelemetry/pom.xml b/ojdbc-provider-opentelemetry/pom.xml
index 01affe12..9f263956 100644
--- a/ojdbc-provider-opentelemetry/pom.xml
+++ b/ojdbc-provider-opentelemetry/pom.xml
@@ -16,10 +16,8 @@