diff --git a/CHANGELOG.md b/CHANGELOG.md index 463bf0573..8bd80c01e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,11 @@ ## Release (YYYY-MM-DD) - `core`: [v0.y.z] -- **Feature:** Add package `runtime`, which implements methods to be used when performing API requests +- **Feature:** Add package `runtime`, which implements methods to be used when performing API requests. - **Feature:** Add method `WithCaptureHTTPResponse` to package `runtime`, which does the same as `config.WithCaptureHTTPResponse`. Method was moved to avoid confusion due to it not being a configuration option, and will be removed in a later release. - **Deprecation:** Mark method `config.WithCaptureHTTPResponse` as deprecated, to avoid confusion due to it not being a configuration option. Use `runtime.WithCaptureHTTPResponse` instead. -- **Deprecation:** Marked method `config.WithJWKSEndpoint` as deprecated. Validation using JWKS was removed, for being redundant with token validation done in the APIs. This option has no effect +- **Deprecation:** Mark method `config.WithJWKSEndpoint` as deprecated. Validation using JWKS was removed, for being redundant with token validation done in the APIs. This option has no effect. +- **Breaking Change:** Remove method `KeyFlow.Clone`, that was no longer being used. ## Release (2024-02-07) diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 53d54b737..8990d64d7 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,11 +1,12 @@ ## v0.9.0 (YYYY-MM-DD) -- **Deprecation:** Marked method `config.WithCaptureHTTPResponse` as deprecated, to avoid confusion due -- **Deprecation:** Marked method `config.WithJWKSEndpoint` as deprecated. Validation using JWKS was removed, for being redundant with token validation done in the APIs. This option has no effect +- **Deprecation:** Mark method `config.WithCaptureHTTPResponse` as deprecated, to avoid confusion due to it not being a configuration option. Use `runtime.WithCaptureHTTPResponse` instead. +- **Deprecation:** Mark method `config.WithJWKSEndpoint` as deprecated. Validation using JWKS was removed, for being redundant with token validation done in the APIs. This option has no effect. +- **Breaking Change:** Remove method `KeyFlow.Clone`, that was no longer being used. ## v0.8.0 (2024-02-16) -- **Feature:** Add package `runtime`, which implements methods to be used when performing API requests +- **Feature:** Add package `runtime`, which implements methods to be used when performing API requests. - **Feature:** Add method `WithCaptureHTTPResponse` to package `runtime`, which does the same as `config.WithCaptureHTTPResponse`. Method was moved to avoid confusion due to it not being a configuration option, and will be removed in a later release. ## v0.7.7 (2024-02-02) diff --git a/core/clients/key_flow.go b/core/clients/key_flow.go index f0f60f884..ab49b682b 100644 --- a/core/clients/key_flow.go +++ b/core/clients/key_flow.go @@ -142,21 +142,6 @@ func (c *KeyFlow) SetToken(accessToken, refreshToken string) error { return nil } -// Clone creates a clone of the client -func (c *KeyFlow) Clone() interface{} { - sc := *c - nc := &sc - cl := *nc.client - cf := *nc.config - ke := *nc.key - to := *nc.token - nc.client = &cl - nc.config = &cf - nc.key = &ke - nc.token = &to - return c -} - // Roundtrip performs the request func (c *KeyFlow) RoundTrip(req *http.Request) (*http.Response, error) { if c.client == nil { diff --git a/core/clients/key_flow_test.go b/core/clients/key_flow_test.go index 6c517731a..30c744bac 100644 --- a/core/clients/key_flow_test.go +++ b/core/clients/key_flow_test.go @@ -8,7 +8,6 @@ import ( "fmt" "io" "net/http" - "reflect" "strings" "testing" "time" @@ -183,25 +182,12 @@ func TestSetToken(t *testing.T) { } } -func TestKeyClone(t *testing.T) { - c := &KeyFlow{ - client: &http.Client{}, - config: &KeyFlowConfig{}, - key: &ServiceAccountKeyResponse{}, - token: &TokenResponseBody{}, +func TestKeyFlowValidateToken(t *testing.T) { + // Generate a random private key + privateKey := make([]byte, 32) + if _, err := rand.Read(privateKey); err != nil { + t.Fatal(err) } - - clone, ok := c.Clone().(*KeyFlow) - if !ok { - t.Fatalf("Type assertion failed") - } - - if !reflect.DeepEqual(c, clone) { - t.Errorf("Clone() = %v, want %v", clone, c) - } -} - -func TestTokenExpired(t *testing.T) { tests := []struct { desc string tokenInvalid bool