Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
7 changes: 4 additions & 3 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
15 changes: 0 additions & 15 deletions core/clients/key_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
24 changes: 5 additions & 19 deletions core/clients/key_flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"fmt"
"io"
"net/http"
"reflect"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -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
Expand Down