Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GoogleCloudPlatform/cloud-sql-jdbc-socket-factory
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.18.1
Choose a base ref
...
head repository: GoogleCloudPlatform/cloud-sql-jdbc-socket-factory
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.19.0
Choose a head ref

Commits on May 15, 2024

  1. chore: Add LazyRefreshStrategy implementing the lazy refresh straetgy…

    … (part of #992) (#1970)
    
    Implementation and unit test for the LazyRefreshStrategy.
    
    Part of #992
    hessjcg authored May 15, 2024
    Copy the full SHA
    2c8ae93 View commit details

Commits on May 16, 2024

  1. Copy the full SHA
    5c37897 View commit details
  2. Copy the full SHA
    b26df31 View commit details
  3. Copy the full SHA
    20ea693 View commit details
  4. test: Fix flaky test in lazy refresh, fixes #1980. (#1982)

    Java 8 thread and timing is not as reliable as newer JVMs. This introduces an extra small delay in the tests
    that test the expiration of the data so that it works reliably in Java 8.
    hessjcg authored May 16, 2024
    Copy the full SHA
    5129274 View commit details

Commits on May 17, 2024

  1. Copy the full SHA
    fcb20e5 View commit details
  2. Copy the full SHA
    dbffbf4 View commit details
  3. chore: Add synchronous operation to DefaultConnectionInfoRepository (…

    …part of #992) (#1981)
    
    Adds a new method ConnectionInfoRepository.getConnectorInfoSync() which blocks until it can return a valid
    ConnectorInfo. Adds the implementation of this new method to DefaultConnectionInfoRepository. This is used
    by the LazyRefresher to fetch connection info on the active thread.
    
    Part of Lazy Refresh #992.
    hessjcg authored May 17, 2024
    Copy the full SHA
    31a1655 View commit details

Commits on May 20, 2024

  1. Copy the full SHA
    21bdb91 View commit details
  2. chore(deps): bump jinja2 from 3.1.3 to 3.1.4 in /.kokoro (#1969)

    Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.3 to 3.1.4.
    - [Release notes](https://github.com/pallets/jinja/releases)
    - [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
    - [Commits](pallets/jinja@3.1.3...3.1.4)
    
    ---
    updated-dependencies:
    - dependency-name: jinja2
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored May 20, 2024
    Copy the full SHA
    249f85b View commit details

Commits on May 21, 2024

  1. fix: Remove native image flag that breaks GraalVM CE builds, Fixes #1979

    . (#1991)
    
    Removes the -H:+BuildReport flag from the native image module configuration. This will allow builds
    on GraalVM CE to run successfully.
    
    Fixes #1979
    hessjcg authored May 21, 2024
    Copy the full SHA
    d14892f View commit details

Commits on May 24, 2024

  1. fix: Add TrustManagerFactory workaround for Conscrypt bug, Fixes #1983.…

    … (#1993)
    
    This is a workaround for an underlying bug in the Google Conscrypt crypto library google/conscrypt #1033.
    
    The root cause is that the Conscrypt and OpenJDK X509 certificate libraries sometimes interpret the AuthType
    field differently: Conscrypt finds 'GENERIC' auth type when OpenJDK finds 'UNKNOWN' auth type. This causes certificate validation to fail.
    
    The workaround implemented here is to add a delegate TrustManager that replaces 'GENERIC' auth type with 'UNKNOWN' auth type so that the Conscrypt crypto plays nice with the JDK crypto. See comment on #1033.
    
    I manually tested this on a modified JVM that used Conscrypt as it's primary crypto library. The integration tests passed. I have not found a good way to make this test part of the test suite.
    
    Fixes #1983
    hessjcg authored May 24, 2024
    Copy the full SHA
    0735a91 View commit details

Commits on May 28, 2024

  1. deps: Update dependency com.google.apis:google-api-services-sqladmin …

    …to v1beta4-rev20240521-2.0.0
    
    open
    renovate-bot authored May 28, 2024
    Copy the full SHA
    33ebcf8 View commit details
  2. Copy the full SHA
    00e29db View commit details
  3. Copy the full SHA
    f1b1434 View commit details
  4. Copy the full SHA
    3796a7c View commit details
  5. Copy the full SHA
    3486e1c View commit details
  6. Copy the full SHA
    d1b0f77 View commit details
  7. Copy the full SHA
    94f8436 View commit details
  8. Copy the full SHA
    81f1b2e View commit details
  9. Copy the full SHA
    225454c View commit details

Commits on May 29, 2024

  1. test: Script creation of TLS keys and certificates used in tests. (#2002

    )
    
    Update our tests so that the keys and certificates are generated at test time. This will make TLS tests more flexible
    and easier to update.
    
    Part of #1995
    hessjcg authored May 29, 2024
    Copy the full SHA
    966a45d View commit details
  2. refactor: Refactor RefreshAheadConnectionInfoCache. (#1997)

    This makes a number of refactoring changes to align the Java connector with other implementations.
    
    - Introduce a ConnectionInfoCache interface
    - Rename DefaultConnectionInfoCache to RefreshAheadConnectionInfoCache
    - Update and simplify instantiation logic of RefreshAheadConnectionInfoCache
    
    Part of #992
    hessjcg authored May 29, 2024
    Copy the full SHA
    d97a93b View commit details
  3. feat: Add lazy refresh strategy to the connector. Fixes #992.

    The lazy refresh strategy only refreshes credentials and certificate information when the application attempts
    to establish a new database connection. On Cloud Run and other serverless runtimes, this is more reliable
    than the default background refresh strategy.
    
    Fixes #992
    hessjcg authored May 29, 2024
    Copy the full SHA
    d84d082 View commit details
  4. chore(deps): bump requests from 2.31.0 to 2.32.0 in /.kokoro (#1992)

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored May 29, 2024
    Copy the full SHA
    0b24acb View commit details

Commits on Jun 3, 2024

  1. test: Adds integration test of the Lazy Refresh strategy. Part of #992.…

    … (#1965)
    
    Creating a new lazy refresh strategy will make connectors more reliable on Cloud Run and other serverless platforms.
    
    Fixes #992
    hessjcg authored Jun 3, 2024
    Copy the full SHA
    a20b754 View commit details
  2. Copy the full SHA
    ab3973c View commit details
  3. feat: Configure java connector to check CN instance name. Fixes #1995 (

    …#1996)
    
    This code will make that the connector checks that the server certificate's subject CN field matches the instance name
    before allowing the TLS handshake to proceed.
    
    This introduces new classes that are always installed as trust managers on all TLS connections to ensure that the TLS logic correctly checks that the server certificate's CN field matches the instance.
    
    -  `InstanceCheckingTrustManager` - Delegates to default TLS trust manager, then checks the CN field.
    -  `InstanceCheckingTrustManagerFactory` and `InstanceCheckingTrustManagerFactorySpi` - Installs
         our custom trust manager into connector TLS sockets.
    
    The `ConscryptWorkaroundTrustManagerFactory` and `ConscryptWorkaroundTrustManagerFactorySpi` classes are no longer necessary. Logic to detect Conscrypt and use the workaround `ConscryptWorkaroundTrustManager` moves into `InstanceCheckingTrustManagerFactorySpi`.
    hessjcg authored Jun 3, 2024
    Copy the full SHA
    9346117 View commit details

Commits on Jun 7, 2024

  1. Copy the full SHA
    e790e74 View commit details
  2. Copy the full SHA
    f48ff0e View commit details
  3. Copy the full SHA
    e3b7b19 View commit details
  4. Copy the full SHA
    7e94182 View commit details
  5. Copy the full SHA
    712ca24 View commit details
  6. Copy the full SHA
    0d73283 View commit details
  7. Copy the full SHA
    27389b6 View commit details
  8. Copy the full SHA
    f7a4d70 View commit details
  9. Copy the full SHA
    69a2f39 View commit details
  10. Copy the full SHA
    3e0cec3 View commit details

Commits on Jun 11, 2024

  1. chore(main): release 1.18.2-SNAPSHOT (#1977)

    Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
    release-please[bot] authored Jun 11, 2024
    Copy the full SHA
    c9eba33 View commit details
  2. chore(main): release 1.19.0 (#2017)

    Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
    release-please[bot] authored Jun 11, 2024
    Copy the full SHA
    fdb574a View commit details
Showing with 2,375 additions and 788 deletions.
  1. +2 −2 .github/blunderbuss.yml
  2. +4 −4 .github/workflows/codeql.yml
  3. +1 −1 .github/workflows/labels.yaml
  4. +1 −1 .github/workflows/lint.yaml
  5. +2 −2 .github/workflows/scorecard.yml
  6. +9 −9 .github/workflows/tests.yml
  7. +6 −6 .kokoro/requirements.txt
  8. +1 −1 .mvn/wrapper/maven-wrapper.properties
  9. +40 −0 CHANGELOG.md
  10. +25 −2 core/pom.xml
  11. +26 −0 core/src/main/java/com/google/cloud/sql/core/ConnectionInfo.java
  12. +36 −0 core/src/main/java/com/google/cloud/sql/core/ConnectionInfoCache.java
  13. +7 −1 core/src/main/java/com/google/cloud/sql/core/ConnectionInfoRepository.java
  14. +9 −1 core/src/main/java/com/google/cloud/sql/core/ConnectionMetadata.java
  15. +25 −10 core/src/main/java/com/google/cloud/sql/core/Connector.java
  16. +117 −0 core/src/main/java/com/google/cloud/sql/core/ConscryptWorkaroundDelegatingTrustManger.java
  17. +9 −0 core/src/main/java/com/google/cloud/sql/core/DefaultAccessTokenSupplier.java
  18. +0 −154 core/src/main/java/com/google/cloud/sql/core/DefaultConnectionInfoCache.java
  19. +59 −31 core/src/main/java/com/google/cloud/sql/core/DefaultConnectionInfoRepository.java
  20. +7 −1 core/src/main/java/com/google/cloud/sql/core/DefaultConnectionInfoRepositoryFactory.java
  21. +70 −0 core/src/main/java/com/google/cloud/sql/core/InstanceCheckingTrustManagerFactory.java
  22. +75 −0 core/src/main/java/com/google/cloud/sql/core/InstanceCheckingTrustManagerFactorySpi.java
  23. +128 −0 core/src/main/java/com/google/cloud/sql/core/InstanceCheckingTrustManger.java
  24. +79 −0 core/src/main/java/com/google/cloud/sql/core/LazyRefreshConnectionInfoCache.java
  25. +127 −0 core/src/main/java/com/google/cloud/sql/core/LazyRefreshStrategy.java
  26. +95 −0 core/src/main/java/com/google/cloud/sql/core/RefreshAheadConnectionInfoCache.java
  27. +0 −1 ...NF/native-image/com.google.cloud.sql/cloud-sql-jdbc-socket-factory-parent/native-image.properties
  28. +16 −76 core/src/test/java/com/google/cloud/sql/core/CloudSqlCoreTestingBase.java
  29. +50 −6 core/src/test/java/com/google/cloud/sql/core/ConnectorTest.java
  30. +15 −22 core/src/test/java/com/google/cloud/sql/core/FakeSslServer.java
  31. +64 −0 core/src/test/java/com/google/cloud/sql/core/LazyRefreshConnectionInfoCacheTest.java
  32. +181 −0 core/src/test/java/com/google/cloud/sql/core/LazyRefreshStrategyTest.java
  33. +4 −67 core/src/test/java/com/google/cloud/sql/core/MockAdminApi.java
  34. +7 −7 ...ultConnectionInfoCacheConcurrencyTest.java → RefreshAheadConnectionInfoCacheConcurrencyTest.java}
  35. +238 −146 ...e/cloud/sql/core/{DefaultConnectionInfoCacheTest.java → RefreshAheadConnectionInfoCacheTest.java}
  36. +11 −1 core/src/test/java/com/google/cloud/sql/core/StubConnectionInfoRepository.java
  37. +306 −0 core/src/test/java/com/google/cloud/sql/core/TestCertificateGenerator.java
  38. +14 −0 core/src/test/java/com/google/cloud/sql/core/TestDataSupplier.java
  39. +55 −151 core/src/test/java/com/google/cloud/sql/core/TestKeys.java
  40. +11 −9 docs/configuration.md
  41. +26 −8 docs/jdbc.md
  42. +8 −8 docs/r2dbc.md
  43. +5 −5 jdbc/mariadb/pom.xml
  44. +2 −2 jdbc/mysql-j-8/pom.xml
  45. +39 −2 jdbc/postgres/pom.xml
  46. +21 −0 jdbc/postgres/src/test/java/com/google/cloud/sql/postgres/JdbcPostgresIamAuthIntegrationTests.java
  47. +97 −0 ...postgres/src/test/java/com/google/cloud/sql/postgres/JdbcPostgresLazyRefreshIntegrationTests.java
  48. +146 −0 jdbc/postgres/src/test/resources/conscrypt-security.properties
  49. +4 −4 jdbc/sqlserver/pom.xml
  50. +68 −20 pom.xml
  51. +2 −2 r2dbc/core/pom.xml
  52. +4 −4 r2dbc/core/src/test/java/com/google/cloud/sql/core/GcpConnectionFactoryProviderTest.java
  53. +1 −1 r2dbc/core/src/test/java/com/google/cloud/sql/core/{TestKeys.java → R2dbcTestKeys.java}
  54. +2 −2 r2dbc/mariadb/pom.xml
  55. +2 −2 r2dbc/mysql/pom.xml
  56. +2 −2 r2dbc/postgres/pom.xml
  57. +2 −2 r2dbc/sqlserver/pom.xml
  58. +12 −12 versions.txt
4 changes: 2 additions & 2 deletions .github/blunderbuss.yml
Original file line number Diff line number Diff line change
@@ -13,9 +13,9 @@
# limitations under the License.

assign_issues:
- hessjc
- hessjcg
- jackwotherspoon

assign_prs:
- hessjc
- hessjcg
- jackwotherspoon
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -48,24 +48,24 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@b7cec7526559c32f1616476ff32d17ba4c59b2d6 # v3.25.5
uses: github/codeql-action/init@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
with:
languages: ${{ matrix.language }}


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually
- name: Autobuild
uses: github/codeql-action/autobuild@b7cec7526559c32f1616476ff32d17ba4c59b2d6 # v3.25.5
uses: github/codeql-action/autobuild@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@b7cec7526559c32f1616476ff32d17ba4c59b2d6 # v3.25.5
uses: github/codeql-action/analyze@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/labels.yaml
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: micnncim/action-label-syncer@3abd5ab72fda571e69fffd97bd4e0033dd5f495c # v1.3.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ jobs:
console.log('Failed to remove label. Another job may have already removed it!');
}
- name: Checkout code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up JDK 17
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
4 changes: 2 additions & 2 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
persist-credentials: false

@@ -65,6 +65,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@b7cec7526559c32f1616476ff32d17ba4c59b2d6 # v3.25.5
uses: github/codeql-action/upload-sarif@2e230e8fe0ad3a14a340ad0815ddb96d599d2aff # v3.25.8
with:
sarif_file: resultsFiltered.sarif
18 changes: 9 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ jobs:
console.log('Failed to remove label. Another job may have already removed it!');
}
- name: Checkout code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
@@ -73,15 +73,15 @@ jobs:

- id: 'auth'
name: Authenticate to Google Cloud
uses: google-github-actions/auth@55bd3a7c6e2ae7cf1877fd1ccb9d54c0503c457c # v2.1.2
uses: google-github-actions/auth@71fee32a0bb7e97b4d33d548e7d957010649d8fa # v2.1.3
with:
workload_identity_provider: ${{ secrets.PROVIDER_NAME }}
service_account: ${{ secrets.SERVICE_ACCOUNT }}
access_token_lifetime: 600s

- id: 'secrets'
name: Get secrets
uses: google-github-actions/get-secretmanager-secrets@b655b87fa10e527c5c5a3abfd795c6f46e0399b1 # v2.1.1
uses: google-github-actions/get-secretmanager-secrets@dc4a1392bad0fd60aee00bb2097e30ef07a1caae # v2.1.3
with:
secrets: |-
MYSQL_CONNECTION_NAME:${{ secrets.GOOGLE_CLOUD_PROJECT }}/MYSQL_CONNECTION_NAME
@@ -181,7 +181,7 @@ jobs:
console.log('Failed to remove label. Another job may have already removed it!');
}
- name: Checkout code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
@@ -194,15 +194,15 @@ jobs:

- id: 'auth'
name: Authenticate to Google Cloud
uses: google-github-actions/auth@55bd3a7c6e2ae7cf1877fd1ccb9d54c0503c457c # v2.1.2
uses: google-github-actions/auth@71fee32a0bb7e97b4d33d548e7d957010649d8fa # v2.1.3
with:
workload_identity_provider: ${{ secrets.PROVIDER_NAME }}
service_account: ${{ secrets.SERVICE_ACCOUNT }}
access_token_lifetime: 600s

- id: 'secrets'
name: Get secrets
uses: google-github-actions/get-secretmanager-secrets@b655b87fa10e527c5c5a3abfd795c6f46e0399b1 # v2.1.1
uses: google-github-actions/get-secretmanager-secrets@dc4a1392bad0fd60aee00bb2097e30ef07a1caae # v2.1.3
with:
secrets: |-
MYSQL_CONNECTION_NAME:${{ secrets.GOOGLE_CLOUD_PROJECT }}/MYSQL_CONNECTION_NAME
@@ -297,7 +297,7 @@ jobs:
console.log('Failed to remove label. Another job may have already removed it!');
}
- name: Checkout code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
@@ -312,15 +312,15 @@ jobs:

- id: 'auth'
name: Authenticate to Google Cloud
uses: google-github-actions/auth@55bd3a7c6e2ae7cf1877fd1ccb9d54c0503c457c # v2.1.2
uses: google-github-actions/auth@71fee32a0bb7e97b4d33d548e7d957010649d8fa # v2.1.3
with:
workload_identity_provider: ${{ secrets.PROVIDER_NAME }}
service_account: ${{ secrets.SERVICE_ACCOUNT }}
access_token_lifetime: 600s

- id: 'secrets'
name: Get secrets
uses: google-github-actions/get-secretmanager-secrets@b655b87fa10e527c5c5a3abfd795c6f46e0399b1 # v2.1.1
uses: google-github-actions/get-secretmanager-secrets@dc4a1392bad0fd60aee00bb2097e30ef07a1caae # v2.1.3
with:
secrets: |-
MYSQL_CONNECTION_NAME:${{ secrets.GOOGLE_CLOUD_PROJECT }}/MYSQL_CONNECTION_NAME
12 changes: 6 additions & 6 deletions .kokoro/requirements.txt
Original file line number Diff line number Diff line change
@@ -337,9 +337,9 @@ jeepney==0.8.0 \
# via
# keyring
# secretstorage
jinja2==3.1.3 \
--hash=sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa \
--hash=sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90
jinja2==3.1.4 \
--hash=sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369 \
--hash=sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d
# via gcp-releasetool
keyring==24.3.0 \
--hash=sha256:4446d35d636e6a10b8bce7caa66913dd9eca5fd222ca03a3d42c38608ac30836 \
@@ -468,9 +468,9 @@ python-dateutil==2.8.2 \
--hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \
--hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9
# via gcp-releasetool
requests==2.31.0 \
--hash=sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f \
--hash=sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1
requests==2.32.0 \
--hash=sha256:f2c3881dddb70d056c5bd7600a4fae312b2a300e39be6a118d30b90bd27262b5 \
--hash=sha256:fa5490319474c82ef1d2c9bc459d3652e3ae4ef4c4ebdd18a21145a47ca4b6b8
# via
# gcp-releasetool
# google-api-core
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.1
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.7/apache-maven-3.9.7-bin.zip
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# Changelog

## [1.19.0](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/compare/v1.18.1...v1.19.0) (2024-06-11)


### Features

* Add lazy refresh strategy to the connector. Fixes [#992](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/issues/992). ([d84d082](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/d84d0827cbfe733f33309579d8ac8728ef7d63d1))
* Configure java connector to check CN instance name. Fixes [#1995](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/issues/1995) ([#1996](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/issues/1996)) ([9346117](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/93461176c2426e6a62c15d4b2e101f4283e1e92b))


### Bug Fixes

* Add TrustManagerFactory workaround for Conscrypt bug, Fixes [#1983](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/issues/1983). ([#1993](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/issues/1993)) ([0735a91](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/0735a916df2d89250f844b3c617e90564c3a950e))
* Remove native image flag that breaks GraalVM CE builds, Fixes [#1979](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/issues/1979). ([#1991](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/issues/1991)) ([d14892f](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/d14892fb5dffd872c4ad3a3fe0560a8887fae0fd))


### Dependencies

* Update com.google.http-client dependencies to v1.44.2 ([f1b1434](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/f1b1434f60dbeca064380097c3856c2506010872))
* Update dependency com.google.api-client:google-api-client to v2.5.1 ([fcb20e5](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/fcb20e554166a62cf7c02bedafe4d77ac6a722af))
* Update dependency com.google.api-client:google-api-client to v2.6.0 ([ab3973c](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/ab3973ce5f50ac1367434aa146feb4c5d842f97d))
* Update dependency com.google.api:gax to v2.48.1 ([20ea693](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/20ea693a80a7a319f983027fc658a2419efdc6d2))
* Update dependency com.google.api:gax to v2.49.0 ([f7a4d70](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/f7a4d700502b5438e2b035d1f12226ecebedc4c8))
* Update dependency com.google.apis:google-api-services-sqladmin to v1beta4-rev20240521-2.0.0 ([33ebcf8](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/33ebcf8a21dc31a542d1cd0c3ca876702866ebd4))
* Update dependency com.google.auto.value:auto-value-annotations to v1.11.0 ([0d73283](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/0d73283ec9b4fd1482100b6dddc0c867199fd822))
* Update dependency com.google.cloud:google-cloud-shared-config to v1.8.0 ([e3b7b19](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/e3b7b196f1655ba2606e9a9bdd70f76c7dfd92cf))
* Update dependency com.google.errorprone:error_prone_annotations to v2.28.0 ([7e94182](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/7e941820b6a3bc87d06572d29bc779ace2cbec96))
* Update dependency com.google.guava:guava to v33.2.1-android ([712ca24](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/712ca2442c39f090c06e3322a5b3605c6fb7f798))
* Update dependency com.microsoft.sqlserver:mssql-jdbc to v12.6.2.jre8 ([d1b0f77](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/d1b0f77ba6322ddb66ada356c994b9845a1c25d4))
* Update dependency kr.motd.maven:os-maven-plugin to v1.7.1 ([94f8436](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/94f843690a0fbbfc3fa59eb576b9316e9ef4eb42))
* Update dependency maven to v3.9.7 ([81f1b2e](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/81f1b2e9346f4ea54ab84c32eae87a39dd7c043a))
* Update dependency org.apache.maven.plugins:maven-checkstyle-plugin to v3.4.0 ([3e0cec3](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/3e0cec380bc2f1a71dc7af9250e106af03d35061))
* Update dependency org.apache.maven.plugins:maven-enforcer-plugin to v3.5.0 ([e790e74](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/e790e7441760d4a859bc2fe0df3068bf9e8b2687))
* Update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.7.0 ([27389b6](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/27389b674ec0f00821015eb45edf47779be0cab7))
* Update dependency org.checkerframework:checker-qual to v3.43.0 ([5c37897](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/5c378970b254419bcd4e5af063eb3a000bd9ab39))
* Update dependency org.checkerframework:checker-qual to v3.44.0 ([69a2f39](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/69a2f3927d8ee9ca2f90a212c34cab63b0706929))
* Update dependency org.mariadb.jdbc:mariadb-java-client to v3.4.0 ([3796a7c](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/3796a7c6f5bd70b554515122204f5fbc771c6db1))
* Update dependency org.sonatype.plugins:nexus-staging-maven-plugin to v1.7.0 ([225454c](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/225454c877569b68e3e9a2e76c1e59244dc45ad0))
* Update native-image.version to v0.10.2 ([dbffbf4](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/dbffbf48c38b25f47b85fa50e4b938ebf88f9357))
* Update netty and r2dbc dependencies to v4.1.110.Final ([3486e1c](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/commit/3486e1ccfe026e8fddab821b14ced003a0b8f2ac))

## [1.18.1](https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/compare/v1.18.0...v1.18.1) (2024-05-14)


27 changes: 25 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
@@ -23,10 +23,10 @@
<parent>
<groupId>com.google.cloud.sql</groupId>
<artifactId>jdbc-socket-factory-parent</artifactId>
<version>1.18.1</version><!-- {x-version-update:jdbc-socket-factory-parent:current} -->
<version>1.19.0</version><!-- {x-version-update:jdbc-socket-factory-parent:current} -->
</parent>
<artifactId>jdbc-socket-factory-core</artifactId>
<version>1.18.1</version><!-- {x-version-update:jdbc-socket-factory-core:current} -->
<version>1.19.0</version><!-- {x-version-update:jdbc-socket-factory-core:current} -->
<packaging>jar</packaging>

<name>Cloud SQL Core Socket Factory (Core Library, don't depend on this directly)</name>
@@ -190,6 +190,11 @@
<artifactId>bcpkix-jdk15on</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<scope>test</scope>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
@@ -229,5 +234,23 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>google-conscript</id>
<dependencies>
<dependency>
<groupId>org.conscrypt</groupId>
<artifactId>conscrypt-openjdk-uber</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.70</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>

</project>
26 changes: 26 additions & 0 deletions core/src/main/java/com/google/cloud/sql/core/ConnectionInfo.java
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
import com.google.cloud.sql.IpType;
import java.time.Instant;
import java.util.Map;
import java.util.stream.Collectors;
import javax.net.ssl.SSLContext;

/** Represents the results of a certificate and metadata refresh operation. */
@@ -51,4 +52,29 @@ Map<IpType, String> getIpAddrs() {
SslData getSslData() {
return sslData;
}

ConnectionMetadata toConnectionMetadata(
ConnectionConfig config, CloudSqlInstanceName instanceName) {
String preferredIp = null;

for (IpType ipType : config.getIpTypes()) {
preferredIp = getIpAddrs().get(ipType);
if (preferredIp != null) {
break;
}
}
if (preferredIp == null) {
throw new IllegalArgumentException(
String.format(
"[%s] Cloud SQL instance does not have any IP addresses matching preferences (%s)",
instanceName.getConnectionName(),
config.getIpTypes().stream().map(IpType::toString).collect(Collectors.joining(","))));
}

return new ConnectionMetadata(
preferredIp,
sslData.getKeyManagerFactory(),
sslData.getTrustManagerFactory(),
sslData.getSslContext());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.sql.core;

/** ConnectionInfoCache is the contract for a caching strategy for ConnectionInfo. */
interface ConnectionInfoCache {

/**
* Returns metadata needed to create a connection to the instance.
*
* @return returns ConnectionMetadata containing the preferred IP and SSL connection data.
* @throws IllegalArgumentException If the instance has no IP addresses matching the provided
* preferences.
*/
ConnectionMetadata getConnectionMetadata(long timeoutMs);

void forceRefresh();

void refreshIfExpired();

void close();
}
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -30,4 +30,10 @@ ListenableFuture<ConnectionInfo> getConnectionInfo(
AuthType authType,
ListeningScheduledExecutorService executor,
ListenableFuture<KeyPair> keyPair);

ConnectionInfo getConnectionInfoSync(
CloudSqlInstanceName instanceName,
AccessTokenSupplier accessTokenSupplier,
AuthType authType,
KeyPair keyPair);
}
Loading