Skip to content

Commit 1f9e481

Browse files
Restore GCP Provider (#131)
* Restore GCP Provider * Updated GCP libraries * removed ${extensions-version} from gpc, was removed from main * Updated GCP pom version * Updated from main and adapted to new driver version * Renamed service provider file * Added type parameter and forced parser type to JSON * Update README.md * removed object names from samples --------- Co-authored-by: Fernanda Meheust <[email protected]>
1 parent bf9810e commit 1f9e481

File tree

47 files changed

+4117
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4117
-3
lines changed

.github/workflows/run-tests.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,16 @@ jobs:
3333

3434
- name: Install dependencies
3535
run: mvn install -DskipTests
36+
37+
- name: Set GCP environment variables
38+
run : |
39+
echo "GOOGLE_APPLICATION_CREDENTIALS=$HOME/.gcp/config.json" >> $GITHUB_ENV
3640
3741
- name: Prepare certificate and properties files
3842
run: |
3943
mkdir -p $HOME/.azure
4044
mkdir -p $HOME/.oci
45+
mkdir -p $HOME/.gcp
4146
4247
# Prepare certificate
4348
echo "${{ secrets.TEST_AZURE_CERTIFICATE }}" > $HOME/.azure/ojdbc-plugin-test-app.pem
@@ -131,6 +136,9 @@ jobs:
131136
AWS_SECRETS_MANAGER_URL=${{ secrets.TEST_AWS_SECRETS_MANAGER_URL }}\n
132137
" >> ojdbc-provider-aws/test.properties
133138
139+
# Generate GCP config
140+
echo "${{ secrets.TEST_GCP_CONFIG }}" > $HOME/.gcp/config.json
141+
echo "${{ secrets.GCP_TEST_PROPERTIES }}" > ojdbc-provider-gcp/test.properties
134142
135143
# Generate ojdbc-provider-hashicorp/test.properties
136144
echo -e "VAULT_ADDR=${{ secrets.TEST_VAULT_ADDR }}\n
@@ -165,6 +173,9 @@ jobs:
165173
rm ojdbc-provider-azure/ojdbc-provider-test-app.pfx
166174
rm ojdbc-provider-azure/test.properties
167175
176+
rm $HOME/.gcp/config.json
177+
rm ojdbc-provider-gcp/test.properties
178+
168179
rm ojdbc-provider-jackson-oson/test.properties
169180
170181
rm ojdbc-provider-aws/test.properties

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Each module of this project contains a set of providers.
1313
<dd>Providers for integration with Oracle Cloud Infrastructure (OCI).</dd>
1414
<dt><a href="ojdbc-provider-azure/README.md">Oracle JDBC Azure Providers</a></dt>
1515
<dd>Providers for integration with Microsoft Azure</dd>
16+
<dt><a href="ojdbc-provider-gcp/README.md">Oracle JDBC GCP Providers</a></dt>
17+
<dd>Providers for integration with Google Cloud Platform</dd>
1618
<dt><a href="ojdbc-provider-hashicorp/README.md">Oracle JDBC HashiCorp Providers</a></dt>
1719
<dd>Providers for integration with Hashicorp</dd>
1820
</dl>
@@ -130,6 +132,8 @@ this project:
130132

131133
[ojdbc-provider-azure](ojdbc-provider-azure/README.md#installation)
132134

135+
[ojdbc-provider-gcp](ojdbc-provider-gcp/README.md#installation)
136+
133137
[ojdbc-provider-opentelemetry](ojdbc-provider-opentelemetry/README.md#installation)
134138

135139
[ojdbc-provider-jackson-oson](ojdbc-provider-jackson-oson/README.md#installation)

ojdbc-provider-gcp/README.md

+371
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
################################################################################
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
#
4+
# The Universal Permissive License (UPL), Version 1.0
5+
#
6+
# Subject to the condition set forth below, permission is hereby granted to any
7+
# person obtaining a copy of this software, associated documentation and/or data
8+
# (collectively the "Software"), free of charge and under any and all copyright
9+
# rights in the Software, and any and all patent rights owned or freely
10+
# licensable by each licensor hereunder covering either (i) the unmodified
11+
# Software as contributed to or provided by such licensor, or (ii) the Larger
12+
# Works (as defined below), to deal in both
13+
#
14+
# (a) the Software, and
15+
# (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
16+
# one is included with the Software (each a "Larger Work" to which the Software
17+
# is contributed by such licensors),
18+
#
19+
# without restriction, including without limitation the rights to copy, create
20+
# derivative works of, display, perform, and distribute the Software and make,
21+
# use, sell, offer for sale, import, export, have made, and have sold the
22+
# Software and the Larger Work(s), and to sublicense the foregoing rights on
23+
# either these or other terms.
24+
#
25+
# This license is subject to the following condition:
26+
# The above copyright notice and either this complete permission notice or at
27+
# a minimum a reference to the UPL must be included in all copies or
28+
# substantial portions of the Software.
29+
#
30+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36+
# SOFTWARE.
37+
################################################################################
38+
39+
# An example of a connection properties file that configures Oracle JDBC to
40+
# obtain a TLS wallet and SEPS credentials from GCP Secret Manager.
41+
#
42+
# This file can be located by Oracle JDBC using the "oracle.jdbc.config.file"
43+
# connection property. For details, see:
44+
# https://docs.oracle.com/en/database/oracle/oracle-database/23/jajdb/oracle/jdbc/OracleConnection.html#CONNECTION_PROPERTY_CONFIG_FILE
45+
46+
# Configures the GCP Secret Manager TLS (TCPS) File Provider. The secret version name is
47+
# configured as an environment variable or JVM system property named "GCP_TLS_WALLET_SECRET_VERSION":
48+
oracle.jdbc.provider.tlsConfiguration=ojdbc-provider-gcp-secretmanager-tls
49+
oracle.jdbc.provider.tlsConfiguration.secretVersionName=${GCP_TLS_WALLET_SECRET_VERSION}
50+
51+
# Configures the GCP Secret Manager TLS File Password Provider. The password for the
52+
# file is optional and can be configured as an environment variable or JVM
53+
# system property named "GCP_TLS_FILE_PASSWORD":
54+
oracle.jdbc.provider.tlsConfiguration.walletPassword=${GCP_TLS_FILE_PASSWORD}
55+
56+
# Specifies the file type (SSO, PKCS12, or PEM). This determines how the file is processed.
57+
# This can be configured as an environment variable or JVM system property named "GCP_TLS_FILE_TYPE":
58+
oracle.jdbc.provider.tlsConfiguration.type=${GCP_TLS_FILE_TYPE}
59+
60+
# Configures the GCP Secret Manager SEPS (Secure External Password Store) Provider.
61+
# The secret version name is configured as an environment variable or JVM system property
62+
# named "GCP_SEPS_WALLET_SECRET_VERSION":
63+
oracle.jdbc.provider.username=ojdbc-provider-gcp-secretmanager-seps
64+
oracle.jdbc.provider.password=ojdbc-provider-gcp-secretmanager-seps
65+
66+
# Configures the secret version name for SEPS.
67+
oracle.jdbc.provider.username.secretVersionName=${GCP_SEPS_WALLET_SECRET_VERSION}
68+
oracle.jdbc.provider.password.secretVersionName=${GCP_SEPS_WALLET_SECRET_VERSION}
69+
70+
# Optional password for SEPS Wallet stored in GCP Secret Manager
71+
oracle.jdbc.provider.username.walletPassword=${GCP_SEPS_WALLET_PASSWORD}
72+
oracle.jdbc.provider.password.walletPassword=${GCP_SEPS_WALLET_PASSWORD}
73+
74+
# Optional connection string index for SEPS Wallet
75+
# This determines which set of credentials (username/password) to use from the SEPS Wallet
76+
oracle.jdbc.provider.username.connectionStringIndex=${GCP_SEPS_CONNECTION_STRING_INDEX}
77+
oracle.jdbc.provider.password.connectionStringIndex=${GCP_SEPS_CONNECTION_STRING_INDEX}
+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
################################################################################
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
#
4+
# The Universal Permissive License (UPL), Version 1.0
5+
#
6+
# Subject to the condition set forth below, permission is hereby granted to any
7+
# person obtaining a copy of this software, associated documentation and/or data
8+
# (collectively the "Software"), free of charge and under any and all copyright
9+
# rights in the Software, and any and all patent rights owned or freely
10+
# licensable by each licensor hereunder covering either (i) the unmodified
11+
# Software as contributed to or provided by such licensor, or (ii) the Larger
12+
# Works (as defined below), to deal in both
13+
#
14+
# (a) the Software, and
15+
# (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
16+
# one is included with the Software (each a "Larger Work" to which the Software
17+
# is contributed by such licensors),
18+
#
19+
# without restriction, including without limitation the rights to copy, create
20+
# derivative works of, display, perform, and distribute the Software and make,
21+
# use, sell, offer for sale, import, export, have made, and have sold the
22+
# Software and the Larger Work(s), and to sublicense the foregoing rights on
23+
# either these or other terms.
24+
#
25+
# This license is subject to the following condition:
26+
# The above copyright notice and either this complete permission notice or at
27+
# a minimum a reference to the UPL must be included in all copies or
28+
# substantial portions of the Software.
29+
#
30+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36+
# SOFTWARE.
37+
################################################################################
38+
39+
# This file provides examples of properties that configure tests for GCP in this
40+
# module.
41+
#
42+
# QUICK GUIDE TO RUNNING TESTS:
43+
# 1. Create a copy of this file named "test.properties":
44+
# cp example-test.properties test.properties
45+
# 2. In test.properties, replace example values with real values (the file is
46+
# .gitignore'd, so sensitive info won't be checked in to the repo)
47+
# 3. Comment out any lines for which a value can not be provided (tests are
48+
# skipped if no value is configured).
49+
# 4. mvn clean verify
50+
#
51+
# CONFIGURING TEST PROPERTIES
52+
# Test properties are read from a properties file by the TestProperties class.
53+
# The TestProperties class can be found in:
54+
# ojdbc-provider-common/src/testFixtures/java/oracle/jdbc/provider/TestProperties.java
55+
# The default behavior of TestProperties is to read a file named
56+
# "test.properties" in the current directory. A non-default location may be
57+
# specified as a JVM system property:
58+
# mvn clean verify -Doracle.jdbc.provider.TestProperties=/path/to/my-test.properties
59+
#
60+
# MAINTAINING THIS FILE
61+
# Project maintainers should add an example to this file anytime they write a
62+
# test which requires a new property. Not doing so will inflict pain and
63+
# suffering upon our fellow programmers, and will also lead to increased
64+
# maintenance costs.
65+
66+
# IGNORING UNCONFIGURED PROPERTIES
67+
# No test should cause a build failure due to an unconfigured property.
68+
# Using JUnit terminology: A test should "abort" rather than "fail" when a
69+
# property is not configured. This means that the test does not pass, but it
70+
# does not cause the build to fail either.
71+
# Methods of the TestProperties class will automatically abort a test if a
72+
# property is not configured. The org.junit.jupiter.api.Assumptions class may
73+
# also be used directly to abort a test.
74+
#
75+
# There is NO environment in which ALL tests can be run. Some tests may
76+
# require authentication and configurations for GCP, while others may require
77+
# Azure or OCI setups; these environments are mutually exclusive.
78+
#
79+
# This flexibility ensures that developers can work on specific modules without
80+
# needing to configure all cloud environments. For instance, a developer working
81+
# on GCP provider features should not be required to configure OCI or Azure
82+
# environments in order to run tests for their changes.
83+
84+
# The URL of the GCP Object Storage
85+
GCP_OBJECT_STORAGE_URL=https://storage.googleapis.com/example-bucket
86+
87+
# The version name of a secret stored in GCP Secret Manager for configuration
88+
SECRET_VERSION_NAME_CONFIG=projects/project-id/secrets/my-secret/versions/1
89+
90+
# Secret version name for Username in GCP Secret Manager
91+
GCP_SECRET_MANAGER_USERNAME_SECRET_VERSION=projects/project-id/secrets/username-secret/versions/1
92+
93+
# Secret version name for Password in GCP Secret Manager
94+
GCP_SECRET_MANAGER_PASSWORD_SECRET_VERSION=projects/project-id/secrets/password-secret/versions/1
95+
96+
# PKCS12 TLS Wallet Secret stored in GCP Secret Manager
97+
GCP_PKCS12_TLS_WALLET_SECRET_VERSION_NAME=projects/project-id/secrets/pkcs12-wallet-secret/versions/1
98+
99+
# Password for the PKCS12 Wallet stored in GCP Secret Manager
100+
GCP_PKCS12_TLS_WALLET_PASSWORD=***********
101+
102+
# SSO TLS Wallet Secret stored in GCP Secret Manager
103+
GCP_SSO_TLS_WALLET_SECRET_VERSION_NAME=projects/project-id/secrets/sso-wallet-secret/versions/1
104+
105+
# PEM TLS Wallet Secret stored in GCP Secret Manager
106+
GCP_PEM_TLS_WALLET_SECRET_VERSION_NAME=projects/project-id/secrets/pem-wallet-secret/versions/1
107+
108+
# Password for the PEM Wallet stored in GCP Secret Manager
109+
GCP_PEM_TLS_WALLET_PASSWORD=************
110+
111+
# Corrupted TLS Wallet Secret stored in GCP Secret Manager for negative test cases
112+
GCP_CORRUPTED_TLS_WALLET_SECRET_VERSION_NAME=projects/project-id/secrets/corrupted-wallet-secret/versions/1
113+
114+
# PKCS12 SEPS Secret stored in GCP Secret Manager
115+
GCP_PKCS12_SEPS_SECRET_VERSION_NAME=projects/project-id/secrets/pkcs12-seps-secret/versions/1
116+
117+
# Password for the PKCS12 SEPS Wallet stored in GCP Secret Manager
118+
GCP_PKCS12_SEPS_WALLET_PASSWORD=************
119+
120+
# Optional index to select credentials from the SEPS wallet
121+
GCP_SEPS_CONNECTION_STRING_INDEX=1
122+
123+
# SSO SEPS Secret stored in GCP Secret Manager
124+
GCP_SSO_SEPS_SECRET_VERSION_NAME=projects/project-id/secrets/sso-seps-secret/versions/1
125+
126+
# Corrupted SEPS Wallet Secret stored in GCP Secret Manager for negative test cases
127+
GCP_CORRUPTED_SEPS_WALLET_SECRET_VERSION_NAME=projects/project-id/secrets/corrupted-seps-secret/versions/1
128+
129+
# Secret version name for tnsnames.ora file in GCP Secret Manager
130+
GCP_SECRET_MANAGER_TNS_NAMES_SECRET_VERSION=projects/project-id/secrets/tnsnames-ora-secret/versions/1
131+
132+
# Alias to retrieve specific connection string from tnsnames.ora in GCP Secret Manager
133+
GCP_SECRET_MANAGER_TNS_ALIAS_SECRET_NAME=your_tns_alias
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
################################################################################
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
#
4+
# The Universal Permissive License (UPL), Version 1.0
5+
#
6+
# Subject to the condition set forth below, permission is hereby granted to any
7+
# person obtaining a copy of this software, associated documentation and/or data
8+
# (collectively the "Software"), free of charge and under any and all copyright
9+
# rights in the Software, and any and all patent rights owned or freely
10+
# licensable by each licensor hereunder covering either (i) the unmodified
11+
# Software as contributed to or provided by such licensor, or (ii) the Larger
12+
# Works (as defined below), to deal in both
13+
#
14+
# (a) the Software, and
15+
# (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
16+
# one is included with the Software (each a "Larger Work" to which the Software
17+
# is contributed by such licensors),
18+
#
19+
# without restriction, including without limitation the rights to copy, create
20+
# derivative works of, display, perform, and distribute the Software and make,
21+
# use, sell, offer for sale, import, export, have made, and have sold the
22+
# Software and the Larger Work(s), and to sublicense the foregoing rights on
23+
# either these or other terms.
24+
#
25+
# This license is subject to the following condition:
26+
# The above copyright notice and either this complete permission notice or at
27+
# a minimum a reference to the UPL must be included in all copies or
28+
# substantial portions of the Software.
29+
#
30+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36+
# SOFTWARE.
37+
################################################################################
38+
39+
# An example of a connection properties file that configures Oracle JDBC to
40+
# obtain a username and password from OCI's Vault Service.
41+
#
42+
# This file can be located by Oracle JDBC using the "oracle.jdbc.config.file"
43+
# connection property. For details, see:
44+
# https://docs.oracle.com/en/database/oracle/oracle-database/23/jajdb/oracle/jdbc/OracleConnection.html#CONNECTION_PROPERTY_CONFIG_FILE
45+
46+
# Configures the GCP Vault Secret Username Provider. The resurce name of the
47+
# username secret is configured as an environment variable or JVM system
48+
# property named "USERNAME_SECRET_VERSION_NAME":
49+
oracle.jdbc.provider.username=ojdbc-provider-gcp-secretmanager-username
50+
oracle.jdbc.provider.username.secretVersionName=${USERNAME_SECRET_VERSION_NAME}
51+
52+
# Configures the OCI Vault Secret Password Provider. The resource name of the
53+
# password secret is configured as an environment variable or JVM system
54+
# property named "PASSWORD_SECRET_VERSION_NAME":
55+
oracle.jdbc.provider.password=ojdbc-provider-gcp-secretmanager-password
56+
oracle.jdbc.provider.password.secretVersionName=${PASSWORD_SECRET_VERSION_NAME}
57+
58+
# Configures the GCP Secret Manager Connection String Provider. The secret version name and
59+
# tns alias are configured as environment variables or JVM system properties
60+
# named "GCP_SECRET_VERSION_NAME" and "TNS_ALIAS".
61+
oracle.jdbc.provider.connectionString=ojdbc-provider-gcp-secretmanager-tnsnames
62+
oracle.jdbc.provider.connectionString.secretVersionName=${GCP_SECRET_VERSION_NAME}
63+
oracle.jdbc.provider.connectionString.tnsAlias=${TNS_ALIAS}
64+
65+

0 commit comments

Comments
 (0)