From 2292d63f7bb02571f1527963cf5f6c17de342555 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 18 Mar 2021 13:20:07 +0100 Subject: [PATCH 1/3] chore(deps): bump github.com/sirupsen/logrus from 1.8.0 to 1.8.1 (#89) Bumps [github.com/sirupsen/logrus](https://github.com/sirupsen/logrus) from 1.8.0 to 1.8.1. - [Release notes](https://github.com/sirupsen/logrus/releases) - [Changelog](https://github.com/sirupsen/logrus/blob/master/CHANGELOG.md) - [Commits](https://github.com/sirupsen/logrus/compare/v1.8.0...v1.8.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 5dc5249..49abf7c 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/gorilla/schema v1.2.0 github.com/gorilla/securecookie v1.1.1 github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect - github.com/sirupsen/logrus v1.8.0 + github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.0 golang.org/x/net v0.0.0-20200904194848-62affa334b73 // indirect golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 diff --git a/go.sum b/go.sum index 3cde192..fe24a74 100644 --- a/go.sum +++ b/go.sum @@ -133,8 +133,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magefile/mage v1.10.0 h1:3HiXzCUY12kh9bIuyXShaVe529fJfyqoVM42o/uom2g= -github.com/magefile/mage v1.10.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -143,8 +141,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.8.0 h1:nfhvjKcUMhBMVqbKHJlk5RPrrfYr/NMo3692g0dwfWU= -github.com/sirupsen/logrus v1.8.0/go.mod h1:4GuYW9TZmE769R5STWrRakJc4UqQ3+QQ95fyz7ENv1A= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= From 602592d5f38d39ab1d2e117d3b8f7042411e480d Mon Sep 17 00:00:00 2001 From: Livio Amstutz Date: Thu, 18 Mar 2021 13:35:56 +0100 Subject: [PATCH 2/3] chore(pipeline): add Go 1.16 to matrix build (#90) * chore(pipeline): add 1.16 to matrix build * chore(readme): add GO 1.16 to supported versions --- .github/workflows/release.yml | 2 +- README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 49016bb..e5ca513 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.14', '1.15'] + go: ['1.14', '1.15', '1.16'] name: Go ${{ matrix.go }} test steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 871b03d..41c5d85 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ For your convinience you can find the relevant standards linked below. | <1.13 | :x: | | 1.14 | :white_check_mark: | | 1.15 | :white_check_mark: | +| 1.16 | :white_check_mark: | ## Why another library From 5cd7bae50586a339403b7cf2bc0e18c56b6b703b Mon Sep 17 00:00:00 2001 From: Elio Bischof Date: Thu, 8 Apr 2021 09:54:39 +0200 Subject: [PATCH 3/3] fix: cli client (#92) * fix: cli client * fix: print shutdown error correctly --- pkg/client/rp/cli/cli.go | 15 ++++++++------- pkg/utils/http.go | 8 ++++++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/pkg/client/rp/cli/cli.go b/pkg/client/rp/cli/cli.go index 6cbb364..a00f0bd 100644 --- a/pkg/client/rp/cli/cli.go +++ b/pkg/client/rp/cli/cli.go @@ -13,13 +13,14 @@ const ( loginPath = "/login" ) -func CodeFlow(relyingParty rp.RelyingParty, callbackPath, port string, stateProvider func() string) *oidc.Tokens { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() +func CodeFlow(ctx context.Context, relyingParty rp.RelyingParty, callbackPath, port string, stateProvider func() string) *oidc.Tokens { + codeflowCtx, codeflowCancel := context.WithCancel(ctx) + defer codeflowCancel() + + tokenChan := make(chan *oidc.Tokens, 1) - var token *oidc.Tokens callback := func(w http.ResponseWriter, r *http.Request, tokens *oidc.Tokens, state string) { - token = tokens + tokenChan <- tokens msg := "

Success!

" msg = msg + "

You are authenticated and can now return to the CLI.

" w.Write([]byte(msg)) @@ -27,9 +28,9 @@ func CodeFlow(relyingParty rp.RelyingParty, callbackPath, port string, stateProv http.Handle(loginPath, rp.AuthURLHandler(stateProvider, relyingParty)) http.Handle(callbackPath, rp.CodeExchangeHandler(callback, relyingParty)) - utils.StartServer(ctx, port) + utils.StartServer(codeflowCtx, ":"+port) utils.OpenBrowser("http://localhost:" + port + loginPath) - return token + return <-tokenChan } diff --git a/pkg/utils/http.go b/pkg/utils/http.go index 6632053..27f96f9 100644 --- a/pkg/utils/http.go +++ b/pkg/utils/http.go @@ -97,7 +97,11 @@ func StartServer(ctx context.Context, port string) { go func() { <-ctx.Done() - err := server.Shutdown(ctx) - log.Fatalf("Shutdown(): %v", err) + ctxShutdown, cancelShutdown := context.WithTimeout(context.Background(), 5*time.Second) + defer cancelShutdown() + err := server.Shutdown(ctxShutdown) + if err != nil { + log.Fatalf("Shutdown(): %v", err) + } }() }