From 61e750e4bd308a77fe16d287604fcd48d64c91ce Mon Sep 17 00:00:00 2001 From: Henrique Santos Date: Fri, 16 Feb 2024 15:51:36 +0000 Subject: [PATCH 1/6] Remove functions --- core/clients/key_flow.go | 23 ----------------------- core/clients/key_flow_test.go | 19 ------------------- 2 files changed, 42 deletions(-) diff --git a/core/clients/key_flow.go b/core/clients/key_flow.go index 53bb67085..9c2bcf941 100644 --- a/core/clients/key_flow.go +++ b/core/clients/key_flow.go @@ -99,14 +99,6 @@ func (c *KeyFlow) GetServiceAccountEmail() string { return c.key.Credentials.Iss } -// GetToken returns the token field -func (c *KeyFlow) GetToken() TokenResponseBody { - if c.token == nil { - return TokenResponseBody{} - } - return *c.token -} - func (c *KeyFlow) Init(cfg *KeyFlowConfig) error { c.token = &TokenResponseBody{} c.config = cfg @@ -150,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 6585a4125..79af48490 100644 --- a/core/clients/key_flow_test.go +++ b/core/clients/key_flow_test.go @@ -9,7 +9,6 @@ import ( "fmt" "io" "net/http" - "reflect" "strings" "testing" "time" @@ -189,24 +188,6 @@ func TestSetToken(t *testing.T) { } } -func TestKeyClone(t *testing.T) { - c := &KeyFlow{ - client: &http.Client{}, - config: &KeyFlowConfig{}, - key: &ServiceAccountKeyResponse{}, - token: &TokenResponseBody{}, - } - - 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 TestKeyFlowValidateToken(t *testing.T) { // Generate a random private key privateKey := make([]byte, 32) From 11552476b3606093ba76c491a5d3dc11c561d993 Mon Sep 17 00:00:00 2001 From: Henrique Santos Date: Fri, 16 Feb 2024 15:55:01 +0000 Subject: [PATCH 2/6] Add changelogs --- CHANGELOG.md | 1 + core/CHANGELOG.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dcbfb068..c088edad7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - **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. +- **Breaking Change:** Removed methods `KeyFlow.GetToken` and `KeyFlow.Clone` ## Release (2024-02-07) diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index c447ab88c..dbbd71d88 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,6 +1,7 @@ ## v0.9.0 (YYYY-MM-DD) - **Deprecation:** Mark method `config.WithCaptureHTTPResponse` as deprecated, to avoid confusion due to it not being a configuration option. Use `runtime.WithCaptureHTTPResponse` instead. +- **Breaking Change:** Removed methods `KeyFlow.GetToken` and `KeyFlow.Clone` ## v0.8.0 (2024-02-16) From 285eedae378f9703f16f08702dc5a1910fde3b89 Mon Sep 17 00:00:00 2001 From: Henrique Santos Date: Fri, 16 Feb 2024 17:08:35 +0000 Subject: [PATCH 3/6] Add details to changelog --- CHANGELOG.md | 2 +- core/CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c088edad7..3df1e7b9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - **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. -- **Breaking Change:** Removed methods `KeyFlow.GetToken` and `KeyFlow.Clone` +- **Breaking Change:** Removed methods `KeyFlow.GetToken` and `KeyFlow.Clone`, that were no longer being used. ## Release (2024-02-07) diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index dbbd71d88..4c63d832f 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,7 +1,7 @@ ## v0.9.0 (YYYY-MM-DD) - **Deprecation:** Mark method `config.WithCaptureHTTPResponse` as deprecated, to avoid confusion due to it not being a configuration option. Use `runtime.WithCaptureHTTPResponse` instead. -- **Breaking Change:** Removed methods `KeyFlow.GetToken` and `KeyFlow.Clone` +- **Breaking Change:** Removed methods `KeyFlow.GetToken` and `KeyFlow.Clone`, that were no longer being used. ## v0.8.0 (2024-02-16) From 7ed6a9dc021f03bae4d7ff38beb7476459436ac7 Mon Sep 17 00:00:00 2001 From: Henrique Santos Date: Fri, 16 Feb 2024 18:00:00 +0000 Subject: [PATCH 4/6] Re-add GetToken --- CHANGELOG.md | 2 +- core/CHANGELOG.md | 2 +- core/clients/key_flow.go | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3df1e7b9d..5b52f6a67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - **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. -- **Breaking Change:** Removed methods `KeyFlow.GetToken` and `KeyFlow.Clone`, that were no longer being used. +- **Breaking Change:** Removed method `KeyFlow.Clone`, that were no longer being used. ## Release (2024-02-07) diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 4c63d832f..a23fee544 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,7 +1,7 @@ ## v0.9.0 (YYYY-MM-DD) - **Deprecation:** Mark method `config.WithCaptureHTTPResponse` as deprecated, to avoid confusion due to it not being a configuration option. Use `runtime.WithCaptureHTTPResponse` instead. -- **Breaking Change:** Removed methods `KeyFlow.GetToken` and `KeyFlow.Clone`, that were no longer being used. +- **Breaking Change:** Removed method `KeyFlow.Clone`, that were no longer being used. ## v0.8.0 (2024-02-16) diff --git a/core/clients/key_flow.go b/core/clients/key_flow.go index 9c2bcf941..7c0465e53 100644 --- a/core/clients/key_flow.go +++ b/core/clients/key_flow.go @@ -99,6 +99,14 @@ func (c *KeyFlow) GetServiceAccountEmail() string { return c.key.Credentials.Iss } +// GetToken returns the token field +func (c *KeyFlow) GetToken() TokenResponseBody { + if c.token == nil { + return TokenResponseBody{} + } + return *c.token +} + func (c *KeyFlow) Init(cfg *KeyFlowConfig) error { c.token = &TokenResponseBody{} c.config = cfg From a4d0ea014f33b4560fd6e6f0b240b2184b47f79e Mon Sep 17 00:00:00 2001 From: Henrique Santos Date: Mon, 19 Feb 2024 09:36:25 +0000 Subject: [PATCH 5/6] Fix changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02d384ea0..8bd80c01e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,8 @@ - **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. -- **Breaking Change:** Removed method `KeyFlow.Clone`, that were no longer being used. +- **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) From 0b7164086881ae0c7376dd4d0cff83bafa6116d3 Mon Sep 17 00:00:00 2001 From: Henrique Santos Date: Mon, 19 Feb 2024 09:37:46 +0000 Subject: [PATCH 6/6] Fix changelog --- core/CHANGELOG.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 3f90d16e2..8990d64d7 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,14 +1,12 @@ ## v0.9.0 (YYYY-MM-DD) -- **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:** 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)