Skip to content

Add ReadKeys and RotateKeys methods and extend ConnectionOptions with TokenEndpointAuthMethod and TokenEndpointAuthSigningAlg in ConnectionManager #559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

developerkunal
Copy link
Contributor

🔧 Changes

  • Added ReadKeys and RotateKeys methods to ConnectionManager to support public key retrieval and rotation for JWT verification.
  • Extended ConnectionOptionsOIDC and ConnectionOptionsOkta to support TokenEndpointAuthMethod and TokenEndpointAuthSigningAlg configuration.

📚 References

🔬 Testing

  • All new logic is covered by unit tests.
  • Integration test for ReadKeys implemented using recorded YAML interactions.
  • Manual validation performed for rotation behavior and JWT key verification.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

…ng public keys used in JWT verification.

Extended ConnectionOptionsOIDC and ConnectionOptionsOkta with support for TokenEndpointAuthMethod and TokenEndpointAuthSigningAlg.
@developerkunal developerkunal requested a review from a team as a code owner May 29, 2025 06:55
@codecov-commenter
Copy link

codecov-commenter commented May 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.92%. Comparing base (f5ad30b) to head (1da60a9).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #559      +/-   ##
==========================================
+ Coverage   95.89%   95.92%   +0.03%     
==========================================
  Files          60       60              
  Lines       11852    11940      +88     
==========================================
+ Hits        11366    11454      +88     
  Misses        366      366              
  Partials      120      120              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

developerkunal and others added 2 commits May 30, 2025 22:55
- Included requests and responses for creating a connection, retrieving keys, rotating keys, and deleting connections.
@developerkunal developerkunal requested a review from Copilot May 30, 2025 17:29
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support in the Management API client for fetching and rotating a connection’s public keys, and extends OIDC/Okta connection options with token endpoint authentication settings.

  • Introduce ConnectionKey type and ReadKeys/RotateKeys methods in ConnectionManager with corresponding client, model, and test code.
  • Extend ConnectionOptionsOIDC and ConnectionOptionsOkta with TokenEndpointAuthMethod and TokenEndpointAuthSigningAlg fields, along with getters and tests.
  • Add HTTP录像 files for ReadKeys and RotateKeys endpoints to exercise integration behavior.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
management/connection.go Defined ConnectionKey struct; added ReadKeys and RotateKeys.
management/management.gen.go Generated getters for ConnectionKey and new token endpoint fields.
management/management.gen_test.go Added tests for all new getters (no assertions included).
management/connection_test.go Added integration tests for ReadKeys and RotateKeys.
test/data/recordings/TestConnectionManager_* Recorded HTTP interactions for the new key-management endpoints.
Comments suppressed due to low confidence (1)

management/management.gen_test.go:3296

  • These getter tests call the method but never assert the returned value. Add assertions for the non-nil, nil, and zero-value cases to verify each getter behaves as expected.
func TestConnectionKey_GetAlgorithm(tt *testing.T) {

@developerkunal developerkunal requested a review from Copilot June 2, 2025 05:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces two new methods, ReadKeys and RotateKeys, to the ConnectionManager to fetch and rotate public keys for JWT verification. It also extends ConnectionOptionsOIDC and ConnectionOptionsOkta with two new configuration fields: TokenEndpointAuthMethod and TokenEndpointAuthSigningAlg.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/data/recordings/TestConnectionManager_RotateKeys.yaml New recorded interactions for rotating connection keys.
test/data/recordings/TestConnectionManager_ReadKeys.yaml New recorded interactions for reading connection keys.
management/management.gen_test.go Added unit tests for new getter methods on ConnectionKey and extended connection options.
management/management.gen.go Added getter methods for ConnectionKey and new methods for reading and rotating connection keys.
management/connection_test.go Updated tests to validate the ReadKeys and RotateKeys methods.
management/connection.go Extended connection options with token endpoint configuration fields and implemented ReadKeys/RotateKeys.
Comments suppressed due to low confidence (2)

management/management.gen_test.go:3302

  • Consider adding assertions that verify the expected default return values (e.g., empty string or false) when invoking the getter methods on a nil receiver instead of just calling the methods.
c = nil
	c.GetAlgorithm()

management/connection_test.go:1343

  • Consider employing more specific assertions to verify key rotation behavior, such as asserting that the rotated key is present in the post-rotation key set, rather than relying solely on a difference in array lengths.
assert.NotEqual(t, len(beforeKeys), len(afterKeys), "Keys should be different after rotation")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants