From f645dd3543b89434ccd4ae6334f09f50bd16dc21 Mon Sep 17 00:00:00 2001 From: Livio Amstutz Date: Thu, 10 Sep 2020 08:35:37 +0200 Subject: [PATCH 1/3] fix: unmarshalling of audience as array (#53) --- pkg/oidc/token.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/oidc/token.go b/pkg/oidc/token.go index c468670..a4b8a3d 100644 --- a/pkg/oidc/token.go +++ b/pkg/oidc/token.go @@ -241,10 +241,16 @@ func timeToJSON(t time.Time) int64 { return t.Unix() } -func audienceFromJSON(audience interface{}) []string { - switch aud := audience.(type) { +func audienceFromJSON(i interface{}) []string { + switch aud := i.(type) { case []string: return aud + case []interface{}: + audience := make([]string, len(aud)) + for i, a := range aud { + audience[i] = a.(string) + } + return audience case string: return []string{aud} } From 8f07a5b9c9fa50c3be37d428e71064e7de8a07b3 Mon Sep 17 00:00:00 2001 From: Livio Amstutz Date: Thu, 10 Sep 2020 15:19:55 +0200 Subject: [PATCH 2/3] feat: add possibility to add verifier opts to default RP --- pkg/rp/default_rp.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/rp/default_rp.go b/pkg/rp/default_rp.go index 6c9208d..3a830bb 100644 --- a/pkg/rp/default_rp.go +++ b/pkg/rp/default_rp.go @@ -40,8 +40,9 @@ type DefaultRP struct { errorHandler func(http.ResponseWriter, *http.Request, string, string, string) - verifier Verifier - onlyOAuth2 bool + verifier Verifier + verifierOpts []ConfFunc + onlyOAuth2 bool } //NewDefaultRP creates `DefaultRP` with the given @@ -79,7 +80,7 @@ func NewDefaultRP(rpConfig *Config, rpOpts ...DefaultRPOpts) (DelegationTokenExc } if p.verifier == nil { - p.verifier = NewDefaultVerifier(rpConfig.Issuer, rpConfig.ClientID, NewRemoteKeySet(p.httpClient, p.endpoints.JKWsURL)) + p.verifier = NewDefaultVerifier(rpConfig.Issuer, rpConfig.ClientID, NewRemoteKeySet(p.httpClient, p.endpoints.JKWsURL), p.verifierOpts...) } return p, nil @@ -112,6 +113,12 @@ func WithHTTPClient(client *http.Client) DefaultRPOpts { } } +func WithVerifierOpts(opts ...ConfFunc) DefaultRPOpts { + return func(p *DefaultRP) { + p.verifierOpts = opts + } +} + //AuthURL is the `RelayingParty` interface implementation //wrapping the oauth2 `AuthCodeURL` //returning the url of the auth request From 30f60da90dfd062ee7455004141d3c028519e17b Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Thu, 10 Sep 2020 15:53:17 +0200 Subject: [PATCH 3/3] chore: use only go mod native version (#52) * chore: use only go mod native version * chore: new go versions * update go version in go.mod Co-authored-by: Livio Amstutz --- .github/workflows/release.yml | 2 +- README.md | 6 ++---- go.mod | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 37a842c..18f5c01 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-18.04 strategy: matrix: - go: ['1.11', '1.12', '1.13', '1.14'] + go: ['1.14', '1.15'] name: Go ${{ matrix.go }} test steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index c1d7919..98f318c 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,9 @@ For your convinience you can find the relevant standards linked below. | Version | Supported | |---------|--------------------| -| <1.11 | :x: | -| 1.11 | :white_check_mark: | -| 1.12 | :white_check_mark: | -| 1.13 | :white_check_mark: | +| <1.13 | :x: | | 1.14 | :white_check_mark: | +| 1.15 | :white_check_mark: | ## Why another library diff --git a/go.mod b/go.mod index 594166a..cc9f60b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/caos/oidc -go 1.13 +go 1.15 require ( github.com/caos/logging v0.0.0-20191210002624-b3260f690a6a