From 97f857b15860d6d5f83ad882bfd275b5827da5b9 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Fri, 30 Sep 2022 09:54:54 +0100 Subject: [PATCH 1/8] Start a fake TPP server and run the TPP tests against it Signed-off-by: Richard Wall --- go.mod | 3 +++ go.sum | 3 +++ test/tpp/fake/fake.go | 46 +++++++++++++++++++++++++++++++++++++ test/tpp/fake/fake_test.go | 47 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 test/tpp/fake/fake.go create mode 100644 test/tpp/fake/fake_test.go diff --git a/go.mod b/go.mod index 746d56b6..849c9371 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,16 @@ module github.com/Venafi/vcert/v4 require ( + github.com/go-logr/logr v1.2.3 github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c github.com/pavel-v-chernykh/keystore-go/v4 v4.1.0 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d github.com/spf13/viper v1.7.0 + github.com/stretchr/testify v1.3.0 github.com/urfave/cli/v2 v2.1.1 github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 + golang.org/x/sync v0.0.0-20190423024810-112230192c58 gopkg.in/ini.v1 v1.51.0 gopkg.in/yaml.v2 v2.4.0 software.sslmate.com/src/go-pkcs12 v0.0.0-20180114231543-2291e8f0f237 diff --git a/go.sum b/go.sum index 0f1643e9..2604ca7a 100644 --- a/go.sum +++ b/go.sum @@ -46,6 +46,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -240,6 +242,7 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/test/tpp/fake/fake.go b/test/tpp/fake/fake.go new file mode 100644 index 00000000..c6d412d8 --- /dev/null +++ b/test/tpp/fake/fake.go @@ -0,0 +1,46 @@ +package fake + +import ( + "context" + "net/http" + "net/http/httptest" + + "github.com/go-logr/logr" +) + +type Fake struct { + *httptest.Server +} + +func New() *Fake { + mux := http.NewServeMux() + mux.HandleFunc("/vedauth/authorize/oauth", func(w http.ResponseWriter, req *http.Request) { + defer req.Body.Close() + w.Write([]byte("{}")) + return + }) + ts := httptest.NewUnstartedServer(mux) + return &Fake{ + Server: ts, + } +} + +func (o *Fake) Start(ctx context.Context) { + log := logFromContext(ctx) + log.V(1).Info("starting") + o.Server.StartTLS() +} + +func (o *Fake) Close(ctx context.Context) { + log := logFromContext(ctx) + log.V(1).Info("stopping") + o.Server.Close() +} + +func logFromContext(ctx context.Context) logr.Logger { + log, err := logr.FromContext(ctx) + if err != nil { + panic(err) + } + return log +} diff --git a/test/tpp/fake/fake_test.go b/test/tpp/fake/fake_test.go new file mode 100644 index 00000000..619499b5 --- /dev/null +++ b/test/tpp/fake/fake_test.go @@ -0,0 +1,47 @@ +package fake_test + +import ( + "context" + "os" + "os/exec" + "testing" + "time" + + "golang.org/x/sync/errgroup" + + "github.com/Venafi/vcert/v4/test/tpp/fake" + "github.com/go-logr/logr" + "github.com/go-logr/logr/testr" + "github.com/stretchr/testify/require" +) + +func TestFake(t *testing.T) { + + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + t.Cleanup(cancel) + + grp, ctx := errgroup.WithContext(ctx) + t.Cleanup(func() { + require.NoError(t, grp.Wait()) + }) + + log := testr.NewWithOptions(t, testr.Options{ + Verbosity: 10, + }) + ctx = logr.NewContext(ctx, log) + + s := fake.New() + s.Start(ctx) + t.Cleanup(func() { s.Close(ctx) }) + + cmd := exec.CommandContext(ctx, "make", "tpp_test") + cmd.Dir = "../../.." + cmd.Env = append( + os.Environ(), + "TPP_URL="+s.URL, + ) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + err := cmd.Run() + require.NoError(t, err) +} From 896851a46b8a9c168103b8df710a7b42544aa145 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Fri, 30 Sep 2022 11:15:42 +0100 Subject: [PATCH 2/8] Run tests using GitHub Actions Signed-off-by: Richard Wall --- .github/workflows/test.yaml | 14 ++++++++++++++ Makefile | 4 ++++ test/tpp/fake/fake_test.go | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..d07d5c55 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,14 @@ +name: test +on: + push: + branches: [master] + pull_request: {} +jobs: + fake-tpp: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: 1.18 + - run: make fake_tpp_test diff --git a/Makefile b/Makefile index 3fb4ad8c..31a4a101 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,10 @@ tpp_test: get go test -v $(GOFLAGS) -coverprofile=cov_tpp.out ./pkg/venafi/tpp go tool cover -func=cov_tpp.out +fake_tpp_test: export MAKE := $(MAKE) +fake_tpp_test: + go test ./test/tpp/fake/... + cloud_test: get go test -v $(GOFLAGS) -coverprofile=cov_vaas.out ./pkg/venafi/cloud go tool cover -func=cov_vaas.out diff --git a/test/tpp/fake/fake_test.go b/test/tpp/fake/fake_test.go index 619499b5..31860456 100644 --- a/test/tpp/fake/fake_test.go +++ b/test/tpp/fake/fake_test.go @@ -34,7 +34,7 @@ func TestFake(t *testing.T) { s.Start(ctx) t.Cleanup(func() { s.Close(ctx) }) - cmd := exec.CommandContext(ctx, "make", "tpp_test") + cmd := exec.CommandContext(ctx, os.Getenv("MAKE"), "tpp_test") cmd.Dir = "../../.." cmd.Env = append( os.Environ(), From e753266be119447cd47b1f9af1db8eebee99a62b Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Fri, 30 Sep 2022 14:30:34 +0100 Subject: [PATCH 3/8] Implement enough to satisfy the tests TestPingTPP TestRetrieveSelfIdentity TestGetRefreshToken TestGetRefreshTokenWithDefaultScope /vedauth/authorize/oauth /vedsdk/Identity/Self /vedsdk/certificates/checkpolicy /vedsdk/ Signed-off-by: Richard Wall --- Makefile | 7 +- go.mod | 9 +- go.sum | 72 +- pkg/venafi/tpp/tpp.go | 8 +- test/tpp/fake/fake.go | 155 +++- test/tpp/fake/fake_test.go | 11 +- .../fake/models/authorize_o_auth_request.go | 65 ++ .../fake/models/authorize_o_auth_response.go | 68 ++ test/tpp/fake/models/c_s_r_data.go | 107 +++ test/tpp/fake/models/c_s_r_details.go | 748 ++++++++++++++++++ test/tpp/fake/models/check_policy_request.go | 53 ++ test/tpp/fake/models/check_policy_response.go | 153 ++++ test/tpp/fake/models/compliant_bool_value.go | 53 ++ test/tpp/fake/models/compliant_int_value.go | 53 ++ test/tpp/fake/models/compliant_list_values.go | 53 ++ test/tpp/fake/models/compliant_value.go | 53 ++ test/tpp/fake/models/identity_entry.go | 74 ++ test/tpp/fake/models/identity_web_request.go | 327 ++++++++ test/tpp/fake/models/identity_web_response.go | 282 +++++++ test/tpp/fake/models/key_pair_data.go | 196 +++++ test/tpp/fake/models/locked_int_value.go | 53 ++ test/tpp/fake/models/locked_list_values.go | 53 ++ test/tpp/fake/models/locked_value.go | 53 ++ test/tpp/fake/models/policy_data.go | 361 +++++++++ test/tpp/fake/models/subject_data.go | 288 +++++++ 25 files changed, 3321 insertions(+), 34 deletions(-) create mode 100644 test/tpp/fake/models/authorize_o_auth_request.go create mode 100644 test/tpp/fake/models/authorize_o_auth_response.go create mode 100644 test/tpp/fake/models/c_s_r_data.go create mode 100644 test/tpp/fake/models/c_s_r_details.go create mode 100644 test/tpp/fake/models/check_policy_request.go create mode 100644 test/tpp/fake/models/check_policy_response.go create mode 100644 test/tpp/fake/models/compliant_bool_value.go create mode 100644 test/tpp/fake/models/compliant_int_value.go create mode 100644 test/tpp/fake/models/compliant_list_values.go create mode 100644 test/tpp/fake/models/compliant_value.go create mode 100644 test/tpp/fake/models/identity_entry.go create mode 100644 test/tpp/fake/models/identity_web_request.go create mode 100644 test/tpp/fake/models/identity_web_response.go create mode 100644 test/tpp/fake/models/key_pair_data.go create mode 100644 test/tpp/fake/models/locked_int_value.go create mode 100644 test/tpp/fake/models/locked_list_values.go create mode 100644 test/tpp/fake/models/locked_value.go create mode 100644 test/tpp/fake/models/policy_data.go create mode 100644 test/tpp/fake/models/subject_data.go diff --git a/Makefile b/Makefile index 31a4a101..3622b702 100644 --- a/Makefile +++ b/Makefile @@ -59,13 +59,16 @@ test: get linter go test -v -coverprofile=cov_cmd.out ./cmd/vcert go tool cover -func=cov_cmd.out +WHAT ?= . + tpp_test: get - go test -v $(GOFLAGS) -coverprofile=cov_tpp.out ./pkg/venafi/tpp + go test -v $(GOFLAGS) -coverprofile=cov_tpp.out ./pkg/venafi/tpp -run $(WHAT) go tool cover -func=cov_tpp.out fake_tpp_test: export MAKE := $(MAKE) +fake_tpp_test: export WHAT := ^\(TestPingTPP\|TestRetrieveSelfIdentity\|TestGetRefreshToken\|TestGetRefreshTokenWithDefaultScope\) fake_tpp_test: - go test ./test/tpp/fake/... + go test ./test/tpp/fake/... -count=1 -v cloud_test: get go test -v $(GOFLAGS) -coverprofile=cov_vaas.out ./pkg/venafi/cloud diff --git a/go.mod b/go.mod index 849c9371..27851b02 100644 --- a/go.mod +++ b/go.mod @@ -2,15 +2,18 @@ module github.com/Venafi/vcert/v4 require ( github.com/go-logr/logr v1.2.3 + github.com/go-openapi/errors v0.20.3 + github.com/go-openapi/strfmt v0.21.3 + github.com/go-openapi/swag v0.22.3 github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c github.com/pavel-v-chernykh/keystore-go/v4 v4.1.0 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d github.com/spf13/viper v1.7.0 - github.com/stretchr/testify v1.3.0 + github.com/stretchr/testify v1.8.0 github.com/urfave/cli/v2 v2.1.1 github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a - golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 - golang.org/x/sync v0.0.0-20190423024810-112230192c58 + golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c gopkg.in/ini.v1 v1.51.0 gopkg.in/yaml.v2 v2.4.0 software.sslmate.com/src/go-pkcs12 v0.0.0-20180114231543-2291e8f0f237 diff --git a/go.sum b/go.sum index 2604ca7a..72cc1f63 100644 --- a/go.sum +++ b/go.sum @@ -20,6 +20,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= @@ -33,6 +35,7 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -48,6 +51,13 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.3 h1:rz6kiC84sqNQoqrtulzaL/VERgkoCyB6WdEkc2ujzUc= +github.com/go-openapi/errors v0.20.3/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= +github.com/go-openapi/strfmt v0.21.3 h1:xwhj5X6CjXEZZHMWy1zKJxvW9AfHC9pkyUjLvHtKG7o= +github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -59,14 +69,19 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= @@ -99,6 +114,8 @@ github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c h1:kQWxfPIHVLbgLzphqk3QUflDy9QdksZR4ygR807bpy0= github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= @@ -106,15 +123,20 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= 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/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -125,11 +147,15 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pavel-v-chernykh/keystore-go/v4 v4.1.0 h1:xKxUVGoB9VJU+lgQLPN0KURjw+XCVVSpHfQEeyxk3zo= @@ -138,6 +164,7 @@ github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -177,18 +204,30 @@ github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/urfave/cli/v2 v2.1.1 h1:Qt8FeAtxE/vfdrLmR3rxR6JRE0RoVmbXu8+6kZtYU4k= github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a h1:fZHgsYlfvtyqToslyjUt3VOPF4J7aK/3MPcK7xp3PDk= github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/R083muKhosV54bj5niojjWZvU8xrevuH4= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.mongodb.org/mongo-driver v1.10.0 h1:UtV6N5k14upNp4LTduX0QCufG124fSu25Wz9tu94GLg= +go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -200,8 +239,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -234,7 +273,7 @@ golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -242,8 +281,9 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -258,6 +298,7 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= @@ -265,8 +306,9 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -287,6 +329,8 @@ golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -310,8 +354,10 @@ google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiq google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -322,6 +368,10 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/venafi/tpp/tpp.go b/pkg/venafi/tpp/tpp.go index 59a8b5d4..7a0a4bc7 100644 --- a/pkg/venafi/tpp/tpp.go +++ b/pkg/venafi/tpp/tpp.go @@ -198,11 +198,11 @@ type oauthGetRefreshTokenRequest struct { } type OauthGetRefreshTokenResponse struct { Access_token string `json:"access_token,omitempty"` - Expires int `json:"expires,omitempty"` - ExpiresIn int `json:"expires_in,omitempty"` //Attribute added as it's used on vSSH + Expires uint64 `json:"expires,omitempty"` + ExpiresIn uint64 `json:"expires_in,omitempty"` //Attribute added as it's used on vSSH Identity string `json:"identity,omitempty"` Refresh_token string `json:"refresh_token,omitempty"` - Refresh_until int `json:"refresh_until,omitempty"` + Refresh_until uint64 `json:"refresh_until,omitempty"` Scope string `json:"scope,omitempty"` Token_type string `json:"token_type,omitempty"` } @@ -461,7 +461,7 @@ func (c *Connector) request(method string, resource urlResource, data interface{ defer res.Body.Close() body, err = ioutil.ReadAll(res.Body) // Do not enable trace in production - trace := false // IMPORTANT: sensitive information can be diclosured + trace := true // IMPORTANT: sensitive information can be diclosured // I hope you know what are you doing if trace { log.Println("#################") diff --git a/test/tpp/fake/fake.go b/test/tpp/fake/fake.go index c6d412d8..bcfaef38 100644 --- a/test/tpp/fake/fake.go +++ b/test/tpp/fake/fake.go @@ -2,27 +2,57 @@ package fake import ( "context" + "encoding/json" "net/http" "net/http/httptest" + "sync" + "time" + "github.com/Venafi/vcert/v4/test/tpp/fake/models" "github.com/go-logr/logr" ) -type Fake struct { - *httptest.Server +type state struct { + sync.RWMutex + username string + password string + refreshToken string + accessToken string + refreshTokenExpires time.Time } -func New() *Fake { - mux := http.NewServeMux() - mux.HandleFunc("/vedauth/authorize/oauth", func(w http.ResponseWriter, req *http.Request) { - defer req.Body.Close() - w.Write([]byte("{}")) - return - }) - ts := httptest.NewUnstartedServer(mux) - return &Fake{ - Server: ts, - } +func (o *state) WithUsername(username string) *state { + o.Lock() + defer o.Unlock() + o.username = username + return o +} + +func (o *state) WithPassword(password string) *state { + o.Lock() + defer o.Unlock() + o.password = password + return o +} + +func (o *state) WithRefreshToken(token string) *state { + o.Lock() + defer o.Unlock() + o.accessToken = token + return o +} + +func (o *state) WithAccessToken(token string) *state { + o.Lock() + defer o.Unlock() + o.accessToken = token + return o +} + +type Fake struct { + *state + *httptest.Server + log logr.Logger } func (o *Fake) Start(ctx context.Context) { @@ -37,6 +67,105 @@ func (o *Fake) Close(ctx context.Context) { o.Server.Close() } +func New(log logr.Logger) *Fake { + mux := http.NewServeMux() + ts := httptest.NewUnstartedServer(mux) + f := &Fake{ + log: log, + state: &state{}, + Server: ts, + } + mux.HandleFunc("/vedauth/authorize/oauth", f.handlerAuthorizeOAuth) + mux.HandleFunc("/vedsdk/Identity/Self", f.handlerIdentitySelf) + mux.HandleFunc("/vedsdk/certificates/checkpolicy", f.handlerCertificatesCheckPolicy) + mux.HandleFunc("/vedsdk/", f.handlerPing) + mux.HandleFunc("/", f.handlerCatchAll) + return f +} + +func (o *Fake) handlerAuthorizeOAuth(w http.ResponseWriter, req *http.Request) { + defer req.Body.Close() + o.log.Info("request", "uri", req.RequestURI) + decoder := json.NewDecoder(req.Body) + var in models.AuthorizeOAuthRequest + if err := decoder.Decode(&in); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + if in.Username != o.username || in.Password != o.password { + // Mimics the behavior of TPP 20.4 and above. See: + // https://github.com/jetstack/venafi-oauth-helper/issues/25#issuecomment-854037706 + http.Error(w, `{"error":"invalid_grant","error_description":"Username\/password combination not valid"}`, + http.StatusBadRequest) + return + } + o.WithRefreshToken(o.refreshToken + "x") + o.WithAccessToken(o.accessToken + "x") + out := models.AuthorizeOAuthResponse{ + AccessToken: o.accessToken, + Expires: uint64(time.Now().UTC().Add(time.Hour).Unix()), + RefreshToken: o.refreshToken, + RefreshUntil: uint64(o.refreshTokenExpires.Unix()), + Scope: in.Scope, + TokenType: "Bearer", + Identity: "", + } + encoder := json.NewEncoder(w) + if err := encoder.Encode(&out); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } +} + +func (o *Fake) handlerIdentitySelf(w http.ResponseWriter, req *http.Request) { + defer req.Body.Close() + log := o.log.WithValues("uri", req.RequestURI).WithName("handlerIdentifySelf") + log.V(1).Info("request") + out := models.IdentityWebResponse{ + Identities: []*models.IdentityEntry{ + &models.IdentityEntry{ + Name: "Joe Bloggs", + }, + }, + } + encoder := json.NewEncoder(w) + if err := encoder.Encode(&out); err != nil { + log.Error(err, "While encoding response") + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } +} + +func (o *Fake) handlerCertificatesCheckPolicy(w http.ResponseWriter, req *http.Request) { + defer req.Body.Close() + log := o.log.WithValues("uri", req.RequestURI).WithName("handlerCertificatesCheckPolicy") + log.V(1).Info("request") + decoder := json.NewDecoder(req.Body) + var in models.CheckPolicyRequest + if err := decoder.Decode(&in); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + out := models.CheckPolicyResponse{} + encoder := json.NewEncoder(w) + if err := encoder.Encode(&out); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } +} + +func (o *Fake) handlerPing(w http.ResponseWriter, req *http.Request) { + defer req.Body.Close() + o.log.Info("request", "uri", req.RequestURI) + if req.URL.Path != "/vedsdk/" { + panic(req) + } +} + +func (o *Fake) handlerCatchAll(w http.ResponseWriter, req *http.Request) { + panic(req) +} + func logFromContext(ctx context.Context) logr.Logger { log, err := logr.FromContext(ctx) if err != nil { diff --git a/test/tpp/fake/fake_test.go b/test/tpp/fake/fake_test.go index 31860456..484227c8 100644 --- a/test/tpp/fake/fake_test.go +++ b/test/tpp/fake/fake_test.go @@ -30,7 +30,13 @@ func TestFake(t *testing.T) { }) ctx = logr.NewContext(ctx, log) - s := fake.New() + const ( + tppUsername = "user1" + tppPassword = "password1" + tppZone = "zone1" + ) + s := fake.New(log) + s.WithUsername(tppUsername).WithPassword(tppPassword) s.Start(ctx) t.Cleanup(func() { s.Close(ctx) }) @@ -39,6 +45,9 @@ func TestFake(t *testing.T) { cmd.Env = append( os.Environ(), "TPP_URL="+s.URL, + "TPP_USER="+tppUsername, + "TPP_PASSWORD="+tppPassword, + "TPP_ZONE="+tppZone, ) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr diff --git a/test/tpp/fake/models/authorize_o_auth_request.go b/test/tpp/fake/models/authorize_o_auth_request.go new file mode 100644 index 00000000..acc6f3e1 --- /dev/null +++ b/test/tpp/fake/models/authorize_o_auth_request.go @@ -0,0 +1,65 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AuthorizeOAuthRequest authorize o auth request +// +// swagger:model AuthorizeOAuthRequest +type AuthorizeOAuthRequest struct { + + // client id + ClientID string `json:"client_id,omitempty"` + + // password + Password string `json:"password,omitempty"` + + // redirect uri + RedirectURI string `json:"redirect_uri,omitempty"` + + // scope + Scope string `json:"scope,omitempty"` + + // state + State string `json:"state,omitempty"` + + // username + Username string `json:"username,omitempty"` +} + +// Validate validates this authorize o auth request +func (m *AuthorizeOAuthRequest) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this authorize o auth request based on context it is used +func (m *AuthorizeOAuthRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AuthorizeOAuthRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AuthorizeOAuthRequest) UnmarshalBinary(b []byte) error { + var res AuthorizeOAuthRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/authorize_o_auth_response.go b/test/tpp/fake/models/authorize_o_auth_response.go new file mode 100644 index 00000000..c42552ae --- /dev/null +++ b/test/tpp/fake/models/authorize_o_auth_response.go @@ -0,0 +1,68 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AuthorizeOAuthResponse authorize o auth response +// +// swagger:model AuthorizeOAuthResponse +type AuthorizeOAuthResponse struct { + + // access token + AccessToken string `json:"access_token,omitempty"` + + // expires + Expires uint64 `json:"expires,omitempty"` + + // identity + Identity string `json:"identity,omitempty"` + + // refresh token + RefreshToken string `json:"refresh_token,omitempty"` + + // refresh until + RefreshUntil uint64 `json:"refresh_until,omitempty"` + + // scope + Scope string `json:"scope,omitempty"` + + // token type + TokenType string `json:"token_type,omitempty"` +} + +// Validate validates this authorize o auth response +func (m *AuthorizeOAuthResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this authorize o auth response based on context it is used +func (m *AuthorizeOAuthResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AuthorizeOAuthResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AuthorizeOAuthResponse) UnmarshalBinary(b []byte) error { + var res AuthorizeOAuthResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/c_s_r_data.go b/test/tpp/fake/models/c_s_r_data.go new file mode 100644 index 00000000..04ec2853 --- /dev/null +++ b/test/tpp/fake/models/c_s_r_data.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CSRData c s r data +// +// swagger:model CSRData +type CSRData struct { + + // details + Details *CSRDetails `json:"Details,omitempty"` + + // enrollable + Enrollable bool `json:"Enrollable,omitempty"` +} + +// Validate validates this c s r data +func (m *CSRData) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDetails(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CSRData) validateDetails(formats strfmt.Registry) error { + if swag.IsZero(m.Details) { // not required + return nil + } + + if m.Details != nil { + if err := m.Details.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Details") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Details") + } + return err + } + } + + return nil +} + +// ContextValidate validate this c s r data based on the context it is used +func (m *CSRData) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDetails(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CSRData) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { + + if m.Details != nil { + if err := m.Details.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Details") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Details") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CSRData) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CSRData) UnmarshalBinary(b []byte) error { + var res CSRData + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/c_s_r_details.go b/test/tpp/fake/models/c_s_r_details.go new file mode 100644 index 00000000..a0c2afd2 --- /dev/null +++ b/test/tpp/fake/models/c_s_r_details.go @@ -0,0 +1,748 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CSRDetails c s r details +// +// swagger:model CSRDetails +type CSRDetails struct { + + // city + City *CompliantValue `json:"City,omitempty"` + + // common name + CommonName *CompliantValue `json:"CommonName,omitempty"` + + // country + Country *CompliantValue `json:"Country,omitempty"` + + // elliptic curve + EllipticCurve *CompliantValue `json:"EllipticCurve,omitempty"` + + // key algorithm + KeyAlgorithm *CompliantValue `json:"KeyAlgorithm,omitempty"` + + // key size + KeySize *CompliantIntValue `json:"KeySize,omitempty"` + + // organization + Organization *CompliantValue `json:"Organization,omitempty"` + + // organizational unit + OrganizationalUnit *CompliantListValues `json:"OrganizationalUnit,omitempty"` + + // private key reused + PrivateKeyReused *CompliantBoolValue `json:"PrivateKeyReused,omitempty"` + + // state + State *CompliantValue `json:"State,omitempty"` + + // subj alt name Dns + SubjAltNameDNS *CompliantListValues `json:"SubjAltNameDns,omitempty"` + + // subj alt name email + SubjAltNameEmail *CompliantListValues `json:"SubjAltNameEmail,omitempty"` + + // subj alt name Ip + SubjAltNameIP *CompliantListValues `json:"SubjAltNameIp,omitempty"` + + // subj alt name upn + SubjAltNameUpn *CompliantListValues `json:"SubjAltNameUpn,omitempty"` + + // subj alt name Uri + SubjAltNameURI *CompliantListValues `json:"SubjAltNameUri,omitempty"` +} + +// Validate validates this c s r details +func (m *CSRDetails) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCommonName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCountry(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEllipticCurve(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeyAlgorithm(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeySize(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOrganization(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOrganizationalUnit(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePrivateKeyReused(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSubjAltNameDNS(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSubjAltNameEmail(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSubjAltNameIP(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSubjAltNameUpn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSubjAltNameURI(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CSRDetails) validateCity(formats strfmt.Registry) error { + if swag.IsZero(m.City) { // not required + return nil + } + + if m.City != nil { + if err := m.City.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("City") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("City") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateCommonName(formats strfmt.Registry) error { + if swag.IsZero(m.CommonName) { // not required + return nil + } + + if m.CommonName != nil { + if err := m.CommonName.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("CommonName") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("CommonName") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateCountry(formats strfmt.Registry) error { + if swag.IsZero(m.Country) { // not required + return nil + } + + if m.Country != nil { + if err := m.Country.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Country") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Country") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateEllipticCurve(formats strfmt.Registry) error { + if swag.IsZero(m.EllipticCurve) { // not required + return nil + } + + if m.EllipticCurve != nil { + if err := m.EllipticCurve.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("EllipticCurve") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("EllipticCurve") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateKeyAlgorithm(formats strfmt.Registry) error { + if swag.IsZero(m.KeyAlgorithm) { // not required + return nil + } + + if m.KeyAlgorithm != nil { + if err := m.KeyAlgorithm.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("KeyAlgorithm") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("KeyAlgorithm") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateKeySize(formats strfmt.Registry) error { + if swag.IsZero(m.KeySize) { // not required + return nil + } + + if m.KeySize != nil { + if err := m.KeySize.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("KeySize") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("KeySize") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateOrganization(formats strfmt.Registry) error { + if swag.IsZero(m.Organization) { // not required + return nil + } + + if m.Organization != nil { + if err := m.Organization.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Organization") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Organization") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateOrganizationalUnit(formats strfmt.Registry) error { + if swag.IsZero(m.OrganizationalUnit) { // not required + return nil + } + + if m.OrganizationalUnit != nil { + if err := m.OrganizationalUnit.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("OrganizationalUnit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("OrganizationalUnit") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validatePrivateKeyReused(formats strfmt.Registry) error { + if swag.IsZero(m.PrivateKeyReused) { // not required + return nil + } + + if m.PrivateKeyReused != nil { + if err := m.PrivateKeyReused.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("PrivateKeyReused") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("PrivateKeyReused") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateState(formats strfmt.Registry) error { + if swag.IsZero(m.State) { // not required + return nil + } + + if m.State != nil { + if err := m.State.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("State") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("State") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateSubjAltNameDNS(formats strfmt.Registry) error { + if swag.IsZero(m.SubjAltNameDNS) { // not required + return nil + } + + if m.SubjAltNameDNS != nil { + if err := m.SubjAltNameDNS.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SubjAltNameDns") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("SubjAltNameDns") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateSubjAltNameEmail(formats strfmt.Registry) error { + if swag.IsZero(m.SubjAltNameEmail) { // not required + return nil + } + + if m.SubjAltNameEmail != nil { + if err := m.SubjAltNameEmail.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SubjAltNameEmail") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("SubjAltNameEmail") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateSubjAltNameIP(formats strfmt.Registry) error { + if swag.IsZero(m.SubjAltNameIP) { // not required + return nil + } + + if m.SubjAltNameIP != nil { + if err := m.SubjAltNameIP.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SubjAltNameIp") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("SubjAltNameIp") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateSubjAltNameUpn(formats strfmt.Registry) error { + if swag.IsZero(m.SubjAltNameUpn) { // not required + return nil + } + + if m.SubjAltNameUpn != nil { + if err := m.SubjAltNameUpn.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SubjAltNameUpn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("SubjAltNameUpn") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) validateSubjAltNameURI(formats strfmt.Registry) error { + if swag.IsZero(m.SubjAltNameURI) { // not required + return nil + } + + if m.SubjAltNameURI != nil { + if err := m.SubjAltNameURI.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SubjAltNameUri") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("SubjAltNameUri") + } + return err + } + } + + return nil +} + +// ContextValidate validate this c s r details based on the context it is used +func (m *CSRDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCommonName(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCountry(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateEllipticCurve(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyAlgorithm(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeySize(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOrganization(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOrganizationalUnit(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePrivateKeyReused(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateState(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSubjAltNameDNS(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSubjAltNameEmail(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSubjAltNameIP(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSubjAltNameUpn(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSubjAltNameURI(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CSRDetails) contextValidateCity(ctx context.Context, formats strfmt.Registry) error { + + if m.City != nil { + if err := m.City.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("City") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("City") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateCommonName(ctx context.Context, formats strfmt.Registry) error { + + if m.CommonName != nil { + if err := m.CommonName.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("CommonName") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("CommonName") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateCountry(ctx context.Context, formats strfmt.Registry) error { + + if m.Country != nil { + if err := m.Country.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Country") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Country") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateEllipticCurve(ctx context.Context, formats strfmt.Registry) error { + + if m.EllipticCurve != nil { + if err := m.EllipticCurve.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("EllipticCurve") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("EllipticCurve") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateKeyAlgorithm(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyAlgorithm != nil { + if err := m.KeyAlgorithm.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("KeyAlgorithm") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("KeyAlgorithm") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateKeySize(ctx context.Context, formats strfmt.Registry) error { + + if m.KeySize != nil { + if err := m.KeySize.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("KeySize") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("KeySize") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateOrganization(ctx context.Context, formats strfmt.Registry) error { + + if m.Organization != nil { + if err := m.Organization.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Organization") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Organization") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateOrganizationalUnit(ctx context.Context, formats strfmt.Registry) error { + + if m.OrganizationalUnit != nil { + if err := m.OrganizationalUnit.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("OrganizationalUnit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("OrganizationalUnit") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidatePrivateKeyReused(ctx context.Context, formats strfmt.Registry) error { + + if m.PrivateKeyReused != nil { + if err := m.PrivateKeyReused.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("PrivateKeyReused") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("PrivateKeyReused") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateState(ctx context.Context, formats strfmt.Registry) error { + + if m.State != nil { + if err := m.State.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("State") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("State") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateSubjAltNameDNS(ctx context.Context, formats strfmt.Registry) error { + + if m.SubjAltNameDNS != nil { + if err := m.SubjAltNameDNS.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SubjAltNameDns") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("SubjAltNameDns") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateSubjAltNameEmail(ctx context.Context, formats strfmt.Registry) error { + + if m.SubjAltNameEmail != nil { + if err := m.SubjAltNameEmail.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SubjAltNameEmail") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("SubjAltNameEmail") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateSubjAltNameIP(ctx context.Context, formats strfmt.Registry) error { + + if m.SubjAltNameIP != nil { + if err := m.SubjAltNameIP.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SubjAltNameIp") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("SubjAltNameIp") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateSubjAltNameUpn(ctx context.Context, formats strfmt.Registry) error { + + if m.SubjAltNameUpn != nil { + if err := m.SubjAltNameUpn.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SubjAltNameUpn") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("SubjAltNameUpn") + } + return err + } + } + + return nil +} + +func (m *CSRDetails) contextValidateSubjAltNameURI(ctx context.Context, formats strfmt.Registry) error { + + if m.SubjAltNameURI != nil { + if err := m.SubjAltNameURI.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("SubjAltNameUri") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("SubjAltNameUri") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CSRDetails) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CSRDetails) UnmarshalBinary(b []byte) error { + var res CSRDetails + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/check_policy_request.go b/test/tpp/fake/models/check_policy_request.go new file mode 100644 index 00000000..032937a4 --- /dev/null +++ b/test/tpp/fake/models/check_policy_request.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CheckPolicyRequest check policy request +// +// swagger:model CheckPolicyRequest +type CheckPolicyRequest struct { + + // p k c s10 + PKCS10 string `json:"PKCS10,omitempty"` + + // policy d n + PolicyDN string `json:"PolicyDN,omitempty"` +} + +// Validate validates this check policy request +func (m *CheckPolicyRequest) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this check policy request based on context it is used +func (m *CheckPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CheckPolicyRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CheckPolicyRequest) UnmarshalBinary(b []byte) error { + var res CheckPolicyRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/check_policy_response.go b/test/tpp/fake/models/check_policy_response.go new file mode 100644 index 00000000..d5c72332 --- /dev/null +++ b/test/tpp/fake/models/check_policy_response.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CheckPolicyResponse check policy response +// +// swagger:model CheckPolicyResponse +type CheckPolicyResponse struct { + + // c s r + CSR *CSRData `json:"CSR,omitempty"` + + // error + Error string `json:"Error,omitempty"` + + // policy + Policy *PolicyData `json:"Policy,omitempty"` +} + +// Validate validates this check policy response +func (m *CheckPolicyResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCSR(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePolicy(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CheckPolicyResponse) validateCSR(formats strfmt.Registry) error { + if swag.IsZero(m.CSR) { // not required + return nil + } + + if m.CSR != nil { + if err := m.CSR.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("CSR") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("CSR") + } + return err + } + } + + return nil +} + +func (m *CheckPolicyResponse) validatePolicy(formats strfmt.Registry) error { + if swag.IsZero(m.Policy) { // not required + return nil + } + + if m.Policy != nil { + if err := m.Policy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Policy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Policy") + } + return err + } + } + + return nil +} + +// ContextValidate validate this check policy response based on the context it is used +func (m *CheckPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCSR(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CheckPolicyResponse) contextValidateCSR(ctx context.Context, formats strfmt.Registry) error { + + if m.CSR != nil { + if err := m.CSR.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("CSR") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("CSR") + } + return err + } + } + + return nil +} + +func (m *CheckPolicyResponse) contextValidatePolicy(ctx context.Context, formats strfmt.Registry) error { + + if m.Policy != nil { + if err := m.Policy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Policy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Policy") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CheckPolicyResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CheckPolicyResponse) UnmarshalBinary(b []byte) error { + var res CheckPolicyResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/compliant_bool_value.go b/test/tpp/fake/models/compliant_bool_value.go new file mode 100644 index 00000000..e9af6344 --- /dev/null +++ b/test/tpp/fake/models/compliant_bool_value.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CompliantBoolValue compliant bool value +// +// swagger:model CompliantBoolValue +type CompliantBoolValue struct { + + // compliant + Compliant bool `json:"Compliant,omitempty"` + + // value + Value bool `json:"Value,omitempty"` +} + +// Validate validates this compliant bool value +func (m *CompliantBoolValue) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this compliant bool value based on context it is used +func (m *CompliantBoolValue) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CompliantBoolValue) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CompliantBoolValue) UnmarshalBinary(b []byte) error { + var res CompliantBoolValue + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/compliant_int_value.go b/test/tpp/fake/models/compliant_int_value.go new file mode 100644 index 00000000..fe10d2cd --- /dev/null +++ b/test/tpp/fake/models/compliant_int_value.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CompliantIntValue compliant int value +// +// swagger:model CompliantIntValue +type CompliantIntValue struct { + + // compliant + Compliant bool `json:"Compliant,omitempty"` + + // value + Value int32 `json:"Value,omitempty"` +} + +// Validate validates this compliant int value +func (m *CompliantIntValue) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this compliant int value based on context it is used +func (m *CompliantIntValue) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CompliantIntValue) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CompliantIntValue) UnmarshalBinary(b []byte) error { + var res CompliantIntValue + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/compliant_list_values.go b/test/tpp/fake/models/compliant_list_values.go new file mode 100644 index 00000000..dcfe8b36 --- /dev/null +++ b/test/tpp/fake/models/compliant_list_values.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CompliantListValues compliant list values +// +// swagger:model CompliantListValues +type CompliantListValues struct { + + // compliant + Compliant bool `json:"Compliant,omitempty"` + + // values + Values []string `json:"Values"` +} + +// Validate validates this compliant list values +func (m *CompliantListValues) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this compliant list values based on context it is used +func (m *CompliantListValues) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CompliantListValues) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CompliantListValues) UnmarshalBinary(b []byte) error { + var res CompliantListValues + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/compliant_value.go b/test/tpp/fake/models/compliant_value.go new file mode 100644 index 00000000..5a90b38e --- /dev/null +++ b/test/tpp/fake/models/compliant_value.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CompliantValue compliant value +// +// swagger:model CompliantValue +type CompliantValue struct { + + // compliant + Compliant bool `json:"Compliant,omitempty"` + + // value + Value string `json:"Value,omitempty"` +} + +// Validate validates this compliant value +func (m *CompliantValue) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this compliant value based on context it is used +func (m *CompliantValue) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CompliantValue) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CompliantValue) UnmarshalBinary(b []byte) error { + var res CompliantValue + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/identity_entry.go b/test/tpp/fake/models/identity_entry.go new file mode 100644 index 00000000..60473fde --- /dev/null +++ b/test/tpp/fake/models/identity_entry.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// IdentityEntry identity entry +// +// swagger:model IdentityEntry +type IdentityEntry struct { + + // disabled + Disabled bool `json:"Disabled,omitempty"` + + // full name + FullName string `json:"FullName,omitempty"` + + // is group + IsGroup bool `json:"IsGroup,omitempty"` + + // name + Name string `json:"Name,omitempty"` + + // prefix + Prefix string `json:"Prefix,omitempty"` + + // prefixed name + PrefixedName string `json:"PrefixedName,omitempty"` + + // prefixed universal + PrefixedUniversal string `json:"PrefixedUniversal,omitempty"` + + // type + Type int64 `json:"Type,omitempty"` + + // universal + Universal string `json:"Universal,omitempty"` +} + +// Validate validates this identity entry +func (m *IdentityEntry) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this identity entry based on context it is used +func (m *IdentityEntry) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *IdentityEntry) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IdentityEntry) UnmarshalBinary(b []byte) error { + var res IdentityEntry + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/identity_web_request.go b/test/tpp/fake/models/identity_web_request.go new file mode 100644 index 00000000..8843d946 --- /dev/null +++ b/test/tpp/fake/models/identity_web_request.go @@ -0,0 +1,327 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// IdentityWebRequest identity web request +// +// swagger:model IdentityWebRequest +type IdentityWebRequest struct { + + // attribute name + AttributeName string `json:"AttributeName,omitempty"` + + // container + Container *IdentityEntry `json:"Container,omitempty"` + + // filter + Filter string `json:"Filter,omitempty"` + + // group + Group *IdentityEntry `json:"Group,omitempty"` + + // ID + ID *IdentityEntry `json:"ID,omitempty"` + + // identity type + IdentityType int64 `json:"IdentityType,omitempty"` + + // limit + Limit int32 `json:"Limit,omitempty"` + + // members + Members []*IdentityEntry `json:"Members"` + + // name + Name *IdentityEntry `json:"Name,omitempty"` + + // new group name + NewGroupName string `json:"NewGroupName,omitempty"` + + // old password + OldPassword string `json:"OldPassword,omitempty"` + + // password + Password string `json:"Password,omitempty"` + + // resolve nested + ResolveNested int64 `json:"ResolveNested,omitempty"` + + // show members + ShowMembers bool `json:"ShowMembers,omitempty"` +} + +// Validate validates this identity web request +func (m *IdentityWebRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateContainer(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMembers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IdentityWebRequest) validateContainer(formats strfmt.Registry) error { + if swag.IsZero(m.Container) { // not required + return nil + } + + if m.Container != nil { + if err := m.Container.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Container") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Container") + } + return err + } + } + + return nil +} + +func (m *IdentityWebRequest) validateGroup(formats strfmt.Registry) error { + if swag.IsZero(m.Group) { // not required + return nil + } + + if m.Group != nil { + if err := m.Group.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Group") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Group") + } + return err + } + } + + return nil +} + +func (m *IdentityWebRequest) validateID(formats strfmt.Registry) error { + if swag.IsZero(m.ID) { // not required + return nil + } + + if m.ID != nil { + if err := m.ID.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ID") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ID") + } + return err + } + } + + return nil +} + +func (m *IdentityWebRequest) validateMembers(formats strfmt.Registry) error { + if swag.IsZero(m.Members) { // not required + return nil + } + + for i := 0; i < len(m.Members); i++ { + if swag.IsZero(m.Members[i]) { // not required + continue + } + + if m.Members[i] != nil { + if err := m.Members[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *IdentityWebRequest) validateName(formats strfmt.Registry) error { + if swag.IsZero(m.Name) { // not required + return nil + } + + if m.Name != nil { + if err := m.Name.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Name") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Name") + } + return err + } + } + + return nil +} + +// ContextValidate validate this identity web request based on the context it is used +func (m *IdentityWebRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateContainer(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGroup(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMembers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateName(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IdentityWebRequest) contextValidateContainer(ctx context.Context, formats strfmt.Registry) error { + + if m.Container != nil { + if err := m.Container.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Container") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Container") + } + return err + } + } + + return nil +} + +func (m *IdentityWebRequest) contextValidateGroup(ctx context.Context, formats strfmt.Registry) error { + + if m.Group != nil { + if err := m.Group.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Group") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Group") + } + return err + } + } + + return nil +} + +func (m *IdentityWebRequest) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if m.ID != nil { + if err := m.ID.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ID") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ID") + } + return err + } + } + + return nil +} + +func (m *IdentityWebRequest) contextValidateMembers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Members); i++ { + + if m.Members[i] != nil { + if err := m.Members[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *IdentityWebRequest) contextValidateName(ctx context.Context, formats strfmt.Registry) error { + + if m.Name != nil { + if err := m.Name.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Name") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Name") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IdentityWebRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IdentityWebRequest) UnmarshalBinary(b []byte) error { + var res IdentityWebRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/identity_web_response.go b/test/tpp/fake/models/identity_web_response.go new file mode 100644 index 00000000..741f2b81 --- /dev/null +++ b/test/tpp/fake/models/identity_web_response.go @@ -0,0 +1,282 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// IdentityWebResponse identity web response +// +// swagger:model IdentityWebResponse +type IdentityWebResponse struct { + + // attributes + Attributes []string `json:"Attributes"` + + // ID + ID *IdentityEntry `json:"ID,omitempty"` + + // identities + Identities []*IdentityEntry `json:"Identities"` + + // invalid members + InvalidMembers []*IdentityEntry `json:"InvalidMembers"` + + // members + Members []*IdentityEntry `json:"Members"` + + // message + Message string `json:"Message,omitempty"` +} + +// Validate validates this identity web response +func (m *IdentityWebResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIdentities(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInvalidMembers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMembers(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IdentityWebResponse) validateID(formats strfmt.Registry) error { + if swag.IsZero(m.ID) { // not required + return nil + } + + if m.ID != nil { + if err := m.ID.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ID") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ID") + } + return err + } + } + + return nil +} + +func (m *IdentityWebResponse) validateIdentities(formats strfmt.Registry) error { + if swag.IsZero(m.Identities) { // not required + return nil + } + + for i := 0; i < len(m.Identities); i++ { + if swag.IsZero(m.Identities[i]) { // not required + continue + } + + if m.Identities[i] != nil { + if err := m.Identities[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Identities" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Identities" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *IdentityWebResponse) validateInvalidMembers(formats strfmt.Registry) error { + if swag.IsZero(m.InvalidMembers) { // not required + return nil + } + + for i := 0; i < len(m.InvalidMembers); i++ { + if swag.IsZero(m.InvalidMembers[i]) { // not required + continue + } + + if m.InvalidMembers[i] != nil { + if err := m.InvalidMembers[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("InvalidMembers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("InvalidMembers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *IdentityWebResponse) validateMembers(formats strfmt.Registry) error { + if swag.IsZero(m.Members) { // not required + return nil + } + + for i := 0; i < len(m.Members); i++ { + if swag.IsZero(m.Members[i]) { // not required + continue + } + + if m.Members[i] != nil { + if err := m.Members[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this identity web response based on the context it is used +func (m *IdentityWebResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIdentities(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInvalidMembers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMembers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IdentityWebResponse) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if m.ID != nil { + if err := m.ID.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ID") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ID") + } + return err + } + } + + return nil +} + +func (m *IdentityWebResponse) contextValidateIdentities(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Identities); i++ { + + if m.Identities[i] != nil { + if err := m.Identities[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Identities" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Identities" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *IdentityWebResponse) contextValidateInvalidMembers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.InvalidMembers); i++ { + + if m.InvalidMembers[i] != nil { + if err := m.InvalidMembers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("InvalidMembers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("InvalidMembers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *IdentityWebResponse) contextValidateMembers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Members); i++ { + + if m.Members[i] != nil { + if err := m.Members[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IdentityWebResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IdentityWebResponse) UnmarshalBinary(b []byte) error { + var res IdentityWebResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/key_pair_data.go b/test/tpp/fake/models/key_pair_data.go new file mode 100644 index 00000000..be8fb0b3 --- /dev/null +++ b/test/tpp/fake/models/key_pair_data.go @@ -0,0 +1,196 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// KeyPairData key pair data +// +// swagger:model KeyPairData +type KeyPairData struct { + + // elliptic curve + EllipticCurve *LockedValue `json:"EllipticCurve,omitempty"` + + // key algorithm + KeyAlgorithm *LockedValue `json:"KeyAlgorithm,omitempty"` + + // key size + KeySize *LockedIntValue `json:"KeySize,omitempty"` +} + +// Validate validates this key pair data +func (m *KeyPairData) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEllipticCurve(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeyAlgorithm(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeySize(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *KeyPairData) validateEllipticCurve(formats strfmt.Registry) error { + if swag.IsZero(m.EllipticCurve) { // not required + return nil + } + + if m.EllipticCurve != nil { + if err := m.EllipticCurve.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("EllipticCurve") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("EllipticCurve") + } + return err + } + } + + return nil +} + +func (m *KeyPairData) validateKeyAlgorithm(formats strfmt.Registry) error { + if swag.IsZero(m.KeyAlgorithm) { // not required + return nil + } + + if m.KeyAlgorithm != nil { + if err := m.KeyAlgorithm.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("KeyAlgorithm") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("KeyAlgorithm") + } + return err + } + } + + return nil +} + +func (m *KeyPairData) validateKeySize(formats strfmt.Registry) error { + if swag.IsZero(m.KeySize) { // not required + return nil + } + + if m.KeySize != nil { + if err := m.KeySize.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("KeySize") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("KeySize") + } + return err + } + } + + return nil +} + +// ContextValidate validate this key pair data based on the context it is used +func (m *KeyPairData) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEllipticCurve(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyAlgorithm(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeySize(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *KeyPairData) contextValidateEllipticCurve(ctx context.Context, formats strfmt.Registry) error { + + if m.EllipticCurve != nil { + if err := m.EllipticCurve.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("EllipticCurve") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("EllipticCurve") + } + return err + } + } + + return nil +} + +func (m *KeyPairData) contextValidateKeyAlgorithm(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyAlgorithm != nil { + if err := m.KeyAlgorithm.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("KeyAlgorithm") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("KeyAlgorithm") + } + return err + } + } + + return nil +} + +func (m *KeyPairData) contextValidateKeySize(ctx context.Context, formats strfmt.Registry) error { + + if m.KeySize != nil { + if err := m.KeySize.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("KeySize") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("KeySize") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *KeyPairData) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *KeyPairData) UnmarshalBinary(b []byte) error { + var res KeyPairData + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/locked_int_value.go b/test/tpp/fake/models/locked_int_value.go new file mode 100644 index 00000000..78042366 --- /dev/null +++ b/test/tpp/fake/models/locked_int_value.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// LockedIntValue locked int value +// +// swagger:model LockedIntValue +type LockedIntValue struct { + + // locked + Locked bool `json:"Locked,omitempty"` + + // value + Value int32 `json:"Value,omitempty"` +} + +// Validate validates this locked int value +func (m *LockedIntValue) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this locked int value based on context it is used +func (m *LockedIntValue) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *LockedIntValue) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LockedIntValue) UnmarshalBinary(b []byte) error { + var res LockedIntValue + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/locked_list_values.go b/test/tpp/fake/models/locked_list_values.go new file mode 100644 index 00000000..4f44ca7a --- /dev/null +++ b/test/tpp/fake/models/locked_list_values.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// LockedListValues locked list values +// +// swagger:model LockedListValues +type LockedListValues struct { + + // locked + Locked bool `json:"Locked,omitempty"` + + // values + Values []string `json:"Values"` +} + +// Validate validates this locked list values +func (m *LockedListValues) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this locked list values based on context it is used +func (m *LockedListValues) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *LockedListValues) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LockedListValues) UnmarshalBinary(b []byte) error { + var res LockedListValues + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/locked_value.go b/test/tpp/fake/models/locked_value.go new file mode 100644 index 00000000..d37a34bd --- /dev/null +++ b/test/tpp/fake/models/locked_value.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// LockedValue locked value +// +// swagger:model LockedValue +type LockedValue struct { + + // locked + Locked bool `json:"Locked,omitempty"` + + // value + Value string `json:"Value,omitempty"` +} + +// Validate validates this locked value +func (m *LockedValue) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this locked value based on context it is used +func (m *LockedValue) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *LockedValue) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LockedValue) UnmarshalBinary(b []byte) error { + var res LockedValue + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/policy_data.go b/test/tpp/fake/models/policy_data.go new file mode 100644 index 00000000..c974b896 --- /dev/null +++ b/test/tpp/fake/models/policy_data.go @@ -0,0 +1,361 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PolicyData policy data +// +// swagger:model PolicyData +type PolicyData struct { + + // certificate authority + CertificateAuthority *LockedValue `json:"CertificateAuthority,omitempty"` + + // csr generation + CsrGeneration *LockedValue `json:"CsrGeneration,omitempty"` + + // key generation + KeyGeneration *LockedValue `json:"KeyGeneration,omitempty"` + + // key pair + KeyPair *KeyPairData `json:"KeyPair,omitempty"` + + // management type + ManagementType *LockedValue `json:"ManagementType,omitempty"` + + // private key reuse allowed + PrivateKeyReuseAllowed bool `json:"PrivateKeyReuseAllowed,omitempty"` + + // subj alt name Dns allowed + SubjAltNameDNSAllowed bool `json:"SubjAltNameDnsAllowed,omitempty"` + + // subj alt name email allowed + SubjAltNameEmailAllowed bool `json:"SubjAltNameEmailAllowed,omitempty"` + + // subj alt name Ip allowed + SubjAltNameIPAllowed bool `json:"SubjAltNameIpAllowed,omitempty"` + + // subj alt name upn allowed + SubjAltNameUpnAllowed bool `json:"SubjAltNameUpnAllowed,omitempty"` + + // subj alt name Uri allowed + SubjAltNameURIAllowed bool `json:"SubjAltNameUriAllowed,omitempty"` + + // subject + Subject *SubjectData `json:"Subject,omitempty"` + + // unique subject enforced + UniqueSubjectEnforced bool `json:"UniqueSubjectEnforced,omitempty"` + + // whitelisted domains + WhitelistedDomains []string `json:"WhitelistedDomains"` + + // wildcards allowed + WildcardsAllowed bool `json:"WildcardsAllowed,omitempty"` +} + +// Validate validates this policy data +func (m *PolicyData) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCertificateAuthority(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCsrGeneration(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeyGeneration(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeyPair(formats); err != nil { + res = append(res, err) + } + + if err := m.validateManagementType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSubject(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PolicyData) validateCertificateAuthority(formats strfmt.Registry) error { + if swag.IsZero(m.CertificateAuthority) { // not required + return nil + } + + if m.CertificateAuthority != nil { + if err := m.CertificateAuthority.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("CertificateAuthority") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("CertificateAuthority") + } + return err + } + } + + return nil +} + +func (m *PolicyData) validateCsrGeneration(formats strfmt.Registry) error { + if swag.IsZero(m.CsrGeneration) { // not required + return nil + } + + if m.CsrGeneration != nil { + if err := m.CsrGeneration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("CsrGeneration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("CsrGeneration") + } + return err + } + } + + return nil +} + +func (m *PolicyData) validateKeyGeneration(formats strfmt.Registry) error { + if swag.IsZero(m.KeyGeneration) { // not required + return nil + } + + if m.KeyGeneration != nil { + if err := m.KeyGeneration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("KeyGeneration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("KeyGeneration") + } + return err + } + } + + return nil +} + +func (m *PolicyData) validateKeyPair(formats strfmt.Registry) error { + if swag.IsZero(m.KeyPair) { // not required + return nil + } + + if m.KeyPair != nil { + if err := m.KeyPair.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("KeyPair") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("KeyPair") + } + return err + } + } + + return nil +} + +func (m *PolicyData) validateManagementType(formats strfmt.Registry) error { + if swag.IsZero(m.ManagementType) { // not required + return nil + } + + if m.ManagementType != nil { + if err := m.ManagementType.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ManagementType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ManagementType") + } + return err + } + } + + return nil +} + +func (m *PolicyData) validateSubject(formats strfmt.Registry) error { + if swag.IsZero(m.Subject) { // not required + return nil + } + + if m.Subject != nil { + if err := m.Subject.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Subject") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Subject") + } + return err + } + } + + return nil +} + +// ContextValidate validate this policy data based on the context it is used +func (m *PolicyData) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCertificateAuthority(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCsrGeneration(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyGeneration(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyPair(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateManagementType(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSubject(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PolicyData) contextValidateCertificateAuthority(ctx context.Context, formats strfmt.Registry) error { + + if m.CertificateAuthority != nil { + if err := m.CertificateAuthority.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("CertificateAuthority") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("CertificateAuthority") + } + return err + } + } + + return nil +} + +func (m *PolicyData) contextValidateCsrGeneration(ctx context.Context, formats strfmt.Registry) error { + + if m.CsrGeneration != nil { + if err := m.CsrGeneration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("CsrGeneration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("CsrGeneration") + } + return err + } + } + + return nil +} + +func (m *PolicyData) contextValidateKeyGeneration(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyGeneration != nil { + if err := m.KeyGeneration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("KeyGeneration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("KeyGeneration") + } + return err + } + } + + return nil +} + +func (m *PolicyData) contextValidateKeyPair(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyPair != nil { + if err := m.KeyPair.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("KeyPair") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("KeyPair") + } + return err + } + } + + return nil +} + +func (m *PolicyData) contextValidateManagementType(ctx context.Context, formats strfmt.Registry) error { + + if m.ManagementType != nil { + if err := m.ManagementType.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ManagementType") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ManagementType") + } + return err + } + } + + return nil +} + +func (m *PolicyData) contextValidateSubject(ctx context.Context, formats strfmt.Registry) error { + + if m.Subject != nil { + if err := m.Subject.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Subject") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Subject") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PolicyData) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PolicyData) UnmarshalBinary(b []byte) error { + var res PolicyData + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/test/tpp/fake/models/subject_data.go b/test/tpp/fake/models/subject_data.go new file mode 100644 index 00000000..f33269f2 --- /dev/null +++ b/test/tpp/fake/models/subject_data.go @@ -0,0 +1,288 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SubjectData subject data +// +// swagger:model SubjectData +type SubjectData struct { + + // city + City *LockedValue `json:"City,omitempty"` + + // country + Country *LockedValue `json:"Country,omitempty"` + + // organization + Organization *LockedValue `json:"Organization,omitempty"` + + // organizational unit + OrganizationalUnit *LockedListValues `json:"OrganizationalUnit,omitempty"` + + // state + State *LockedValue `json:"State,omitempty"` +} + +// Validate validates this subject data +func (m *SubjectData) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCountry(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOrganization(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOrganizationalUnit(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SubjectData) validateCity(formats strfmt.Registry) error { + if swag.IsZero(m.City) { // not required + return nil + } + + if m.City != nil { + if err := m.City.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("City") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("City") + } + return err + } + } + + return nil +} + +func (m *SubjectData) validateCountry(formats strfmt.Registry) error { + if swag.IsZero(m.Country) { // not required + return nil + } + + if m.Country != nil { + if err := m.Country.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Country") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Country") + } + return err + } + } + + return nil +} + +func (m *SubjectData) validateOrganization(formats strfmt.Registry) error { + if swag.IsZero(m.Organization) { // not required + return nil + } + + if m.Organization != nil { + if err := m.Organization.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Organization") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Organization") + } + return err + } + } + + return nil +} + +func (m *SubjectData) validateOrganizationalUnit(formats strfmt.Registry) error { + if swag.IsZero(m.OrganizationalUnit) { // not required + return nil + } + + if m.OrganizationalUnit != nil { + if err := m.OrganizationalUnit.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("OrganizationalUnit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("OrganizationalUnit") + } + return err + } + } + + return nil +} + +func (m *SubjectData) validateState(formats strfmt.Registry) error { + if swag.IsZero(m.State) { // not required + return nil + } + + if m.State != nil { + if err := m.State.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("State") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("State") + } + return err + } + } + + return nil +} + +// ContextValidate validate this subject data based on the context it is used +func (m *SubjectData) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCountry(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOrganization(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOrganizationalUnit(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateState(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SubjectData) contextValidateCity(ctx context.Context, formats strfmt.Registry) error { + + if m.City != nil { + if err := m.City.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("City") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("City") + } + return err + } + } + + return nil +} + +func (m *SubjectData) contextValidateCountry(ctx context.Context, formats strfmt.Registry) error { + + if m.Country != nil { + if err := m.Country.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Country") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Country") + } + return err + } + } + + return nil +} + +func (m *SubjectData) contextValidateOrganization(ctx context.Context, formats strfmt.Registry) error { + + if m.Organization != nil { + if err := m.Organization.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Organization") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Organization") + } + return err + } + } + + return nil +} + +func (m *SubjectData) contextValidateOrganizationalUnit(ctx context.Context, formats strfmt.Registry) error { + + if m.OrganizationalUnit != nil { + if err := m.OrganizationalUnit.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("OrganizationalUnit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("OrganizationalUnit") + } + return err + } + } + + return nil +} + +func (m *SubjectData) contextValidateState(ctx context.Context, formats strfmt.Registry) error { + + if m.State != nil { + if err := m.State.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("State") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("State") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SubjectData) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SubjectData) UnmarshalBinary(b []byte) error { + var res SubjectData + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} From 1edc65de03b38a477bb74145bbb2b8dd038de10e Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Fri, 30 Sep 2022 14:55:38 +0100 Subject: [PATCH 4/8] Documentation explaining how the models are generated Signed-off-by: Richard Wall --- test/tpp/fake/models/README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/tpp/fake/models/README.md diff --git a/test/tpp/fake/models/README.md b/test/tpp/fake/models/README.md new file mode 100644 index 00000000..b86e61f8 --- /dev/null +++ b/test/tpp/fake/models/README.md @@ -0,0 +1,28 @@ +# README + +These files are all generated: + +```sh +wget https://venafi-tpp.platform-ops.jetstack.net/vedsdk/docs/swagger.yaml +swagger generate model \ + --model AuthorizeOAuthRequest \ + --model AuthorizeOAuthResponse \ + --model CSRData \ + --model CSRDetails \ + --model CheckPolicyRequest \ + --model CheckPolicyResponse \ + --model CompliantBoolValue \ + --model CompliantIntValue \ + --model CompliantListValues \ + --model CompliantValue \ + --model IdentityEntry \ + --model IdentityWebRequest \ + --model IdentityWebResponse \ + --model KeyPairData \ + --model LockedIntValue \ + --model LockedListValues \ + --model LockedValue \ + --model PolicyData \ + --model SubjectData \ + --model-package test/tpp/fake/models +``` From 09ca6ae564ee9c7edc2f05fc03e9108a97d77562 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Fri, 30 Sep 2022 16:00:29 +0100 Subject: [PATCH 5/8] Implement /vedauth/authorize/token Signed-off-by: Richard Wall --- Makefile | 2 +- go.mod | 1 + pkg/venafi/tpp/tpp.go | 4 +- test/tpp/fake/fake.go | 87 ++++++++++++++----- test/tpp/fake/models/README.md | 1 + .../tpp/fake/models/refresh_o_auth_request.go | 53 +++++++++++ 6 files changed, 121 insertions(+), 27 deletions(-) create mode 100644 test/tpp/fake/models/refresh_o_auth_request.go diff --git a/Makefile b/Makefile index 3622b702..265c29ee 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,7 @@ tpp_test: get go tool cover -func=cov_tpp.out fake_tpp_test: export MAKE := $(MAKE) -fake_tpp_test: export WHAT := ^\(TestPingTPP\|TestRetrieveSelfIdentity\|TestGetRefreshToken\|TestGetRefreshTokenWithDefaultScope\) +fake_tpp_test: export WHAT := ^\(TestPingTPP\|TestRetrieveSelfIdentity\|TestGetRefreshToken\|TestGetRefreshTokenWithDefaultScope\|TestFailRefreshAccessToken\|TestRefreshAccessToken\)$$ fake_tpp_test: go test ./test/tpp/fake/... -count=1 -v diff --git a/go.mod b/go.mod index 27851b02..0adbc2bd 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ require ( github.com/go-openapi/errors v0.20.3 github.com/go-openapi/strfmt v0.21.3 github.com/go-openapi/swag v0.22.3 + github.com/google/uuid v1.1.1 github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c github.com/pavel-v-chernykh/keystore-go/v4 v4.1.0 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d diff --git a/pkg/venafi/tpp/tpp.go b/pkg/venafi/tpp/tpp.go index 7a0a4bc7..ae10010b 100644 --- a/pkg/venafi/tpp/tpp.go +++ b/pkg/venafi/tpp/tpp.go @@ -219,10 +219,10 @@ type oauthCertificateTokenRequest struct { type OauthRefreshAccessTokenResponse struct { Access_token string `json:"access_token,omitempty"` - Expires int `json:"expires,omitempty"` + Expires uint64 `json:"expires,omitempty"` Identity string `json:"identity,omitempty"` Refresh_token string `json:"refresh_token,omitempty"` - Refresh_until int `json:"refresh_until,omitempty"` + Refresh_until uint64 `json:"refresh_until,omitempty"` Token_type string `json:"token_type,omitempty"` } diff --git a/test/tpp/fake/fake.go b/test/tpp/fake/fake.go index bcfaef38..0edd3910 100644 --- a/test/tpp/fake/fake.go +++ b/test/tpp/fake/fake.go @@ -10,15 +10,14 @@ import ( "github.com/Venafi/vcert/v4/test/tpp/fake/models" "github.com/go-logr/logr" + "github.com/google/uuid" ) type state struct { sync.RWMutex - username string - password string - refreshToken string - accessToken string - refreshTokenExpires time.Time + username string + password string + grants map[string]models.AuthorizeOAuthResponse } func (o *state) WithUsername(username string) *state { @@ -35,18 +34,43 @@ func (o *state) WithPassword(password string) *state { return o } -func (o *state) WithRefreshToken(token string) *state { +func (o *state) NewGrant(scope string) models.AuthorizeOAuthResponse { o.Lock() defer o.Unlock() - o.accessToken = token - return o + grant := models.AuthorizeOAuthResponse{ + AccessToken: uuid.Must(uuid.NewRandom()).String(), + Expires: uint64(time.Now().UTC().Add(time.Hour).Unix()), + RefreshToken: uuid.Must(uuid.NewRandom()).String(), + RefreshUntil: uint64(time.Now().Add(24 * time.Hour).Unix()), + Scope: scope, + TokenType: "Bearer", + Identity: "", + } + o.grants[grant.RefreshToken] = grant + return grant } -func (o *state) WithAccessToken(token string) *state { +func (o *state) RefreshGrant(refreshToken string) (grant models.AuthorizeOAuthResponse, found bool) { o.Lock() defer o.Unlock() - o.accessToken = token - return o + grant, found = o.grants[refreshToken] + if !found { + return + } + delete(o.grants, refreshToken) + grant = models.AuthorizeOAuthResponse{ + AccessToken: uuid.Must(uuid.NewRandom()).String(), + Expires: uint64(time.Now().UTC().Add(time.Hour).Unix()), + RefreshToken: uuid.Must(uuid.NewRandom()).String(), + // TPP does absolute refresh-token expiry rather than a sliding expiry. + // The expiry time is the same everytime you rotate the refresh-token. + RefreshUntil: grant.RefreshUntil, + Scope: grant.Scope, + TokenType: "Bearer", + Identity: "", + } + o.grants[grant.RefreshToken] = grant + return } type Fake struct { @@ -71,11 +95,14 @@ func New(log logr.Logger) *Fake { mux := http.NewServeMux() ts := httptest.NewUnstartedServer(mux) f := &Fake{ - log: log, - state: &state{}, + log: log, + state: &state{ + grants: map[string]models.AuthorizeOAuthResponse{}, + }, Server: ts, } mux.HandleFunc("/vedauth/authorize/oauth", f.handlerAuthorizeOAuth) + mux.HandleFunc("/vedauth/authorize/token", f.handlerAuthorizeToken) mux.HandleFunc("/vedsdk/Identity/Self", f.handlerIdentitySelf) mux.HandleFunc("/vedsdk/certificates/checkpolicy", f.handlerCertificatesCheckPolicy) mux.HandleFunc("/vedsdk/", f.handlerPing) @@ -99,19 +126,31 @@ func (o *Fake) handlerAuthorizeOAuth(w http.ResponseWriter, req *http.Request) { http.StatusBadRequest) return } - o.WithRefreshToken(o.refreshToken + "x") - o.WithAccessToken(o.accessToken + "x") - out := models.AuthorizeOAuthResponse{ - AccessToken: o.accessToken, - Expires: uint64(time.Now().UTC().Add(time.Hour).Unix()), - RefreshToken: o.refreshToken, - RefreshUntil: uint64(o.refreshTokenExpires.Unix()), - Scope: in.Scope, - TokenType: "Bearer", - Identity: "", + grant := o.NewGrant(in.Scope) + encoder := json.NewEncoder(w) + if err := encoder.Encode(&grant); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } +} + +func (o *Fake) handlerAuthorizeToken(w http.ResponseWriter, req *http.Request) { + defer req.Body.Close() + log := o.log.WithValues("uri", req.RequestURI).WithName("handlerAuthorizeToken") + log.V(1).Info("request") + decoder := json.NewDecoder(req.Body) + var in models.RefreshOAuthRequest + if err := decoder.Decode(&in); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + grant, found := o.RefreshGrant(in.RefreshToken) + if !found { + http.Error(w, "bad token", http.StatusBadRequest) + return } encoder := json.NewEncoder(w) - if err := encoder.Encode(&out); err != nil { + if err := encoder.Encode(&grant); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } diff --git a/test/tpp/fake/models/README.md b/test/tpp/fake/models/README.md index b86e61f8..8fd9f9e3 100644 --- a/test/tpp/fake/models/README.md +++ b/test/tpp/fake/models/README.md @@ -23,6 +23,7 @@ swagger generate model \ --model LockedListValues \ --model LockedValue \ --model PolicyData \ + --model RefreshOAuthRequest \ --model SubjectData \ --model-package test/tpp/fake/models ``` diff --git a/test/tpp/fake/models/refresh_o_auth_request.go b/test/tpp/fake/models/refresh_o_auth_request.go new file mode 100644 index 00000000..5ad70c19 --- /dev/null +++ b/test/tpp/fake/models/refresh_o_auth_request.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// RefreshOAuthRequest refresh o auth request +// +// swagger:model RefreshOAuthRequest +type RefreshOAuthRequest struct { + + // client id + ClientID string `json:"client_id,omitempty"` + + // refresh token + RefreshToken string `json:"refresh_token,omitempty"` +} + +// Validate validates this refresh o auth request +func (m *RefreshOAuthRequest) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this refresh o auth request based on context it is used +func (m *RefreshOAuthRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *RefreshOAuthRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RefreshOAuthRequest) UnmarshalBinary(b []byte) error { + var res RefreshOAuthRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} From 9183740a2e9f844aa007aae3338b66be11e12424 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Fri, 30 Sep 2022 16:35:05 +0100 Subject: [PATCH 6/8] Check that the user has permission to the application Signed-off-by: Richard Wall --- Makefile | 2 +- go.mod | 5 +- go.sum | 182 +++++++++++++++++++++++++++++++++++-- test/tpp/fake/fake.go | 120 +++++++++++++++++++++--- test/tpp/fake/fake_test.go | 21 ++++- 5 files changed, 302 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 265c29ee..ac4a83a4 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,7 @@ tpp_test: get go tool cover -func=cov_tpp.out fake_tpp_test: export MAKE := $(MAKE) -fake_tpp_test: export WHAT := ^\(TestPingTPP\|TestRetrieveSelfIdentity\|TestGetRefreshToken\|TestGetRefreshTokenWithDefaultScope\|TestFailRefreshAccessToken\|TestRefreshAccessToken\)$$ +fake_tpp_test: export WHAT := ^\(TestPingTPP\|TestRetrieveSelfIdentity\|TestGetRefreshToken\|TestGetRefreshTokenWithDefaultScope\|TestFailRefreshAccessToken\|TestRefreshAccessToken\|TestRefreshAccessTokenNoClientID\|TestAuthenticationAccessToken\)$$ fake_tpp_test: go test ./test/tpp/fake/... -count=1 -v diff --git a/go.mod b/go.mod index 0adbc2bd..63feeaba 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ require ( github.com/go-openapi/errors v0.20.3 github.com/go-openapi/strfmt v0.21.3 github.com/go-openapi/swag v0.22.3 - github.com/google/uuid v1.1.1 + github.com/google/uuid v1.1.2 github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c github.com/pavel-v-chernykh/keystore-go/v4 v4.1.0 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d @@ -14,9 +14,10 @@ require ( github.com/urfave/cli/v2 v2.1.1 github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c + golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 gopkg.in/ini.v1 v1.51.0 gopkg.in/yaml.v2 v2.4.0 + k8s.io/apimachinery v0.25.2 software.sslmate.com/src/go-pkcs12 v0.0.0-20180114231543-2291e8f0f237 ) diff --git a/go.sum b/go.sum index 72cc1f63..c9349798 100644 --- a/go.sum +++ b/go.sum @@ -14,19 +14,28 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -41,26 +50,43 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= +github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/emicklei/go-restful/v3 v3.8.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.20.3 h1:rz6kiC84sqNQoqrtulzaL/VERgkoCyB6WdEkc2ujzUc= github.com/go-openapi/errors v0.20.3/go.mod h1:Z3FlZ4I8jEGxjUK+bugx3on2mIAk4txuAOhlsB1FSgk= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= github.com/go-openapi/strfmt v0.21.3 h1:xwhj5X6CjXEZZHMWy1zKJxvW9AfHC9pkyUjLvHtKG7o= github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -69,23 +95,42 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= @@ -113,20 +158,25 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c h1:kQWxfPIHVLbgLzphqk3QUflDy9QdksZR4ygR807bpy0= github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -135,6 +185,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -150,13 +202,31 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= +github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pavel-v-chernykh/keystore-go/v4 v4.1.0 h1:xKxUVGoB9VJU+lgQLPN0KURjw+XCVVSpHfQEeyxk3zo= github.com/pavel-v-chernykh/keystore-go/v4 v4.1.0/go.mod h1:2ejgys4qY+iNVW1IittZhyRYA6MNv8TgM6VHqojbB9g= @@ -172,6 +242,7 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -192,22 +263,27 @@ github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIK github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= +github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -225,6 +301,10 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a h1:fZHgsYlfvtyqToslyjUt3VOPF4J7aK/3MPcK7xp3PDk= github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/R083muKhosV54bj5niojjWZvU8xrevuH4= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.mongodb.org/mongo-driver v1.10.0 h1:UtV6N5k14upNp4LTduX0QCufG124fSu25Wz9tu94GLg= go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= @@ -238,7 +318,10 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -259,8 +342,13 @@ golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -273,7 +361,17 @@ golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -282,11 +380,15 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -297,15 +399,30 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -321,6 +438,7 @@ golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= @@ -328,9 +446,17 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -349,33 +475,71 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +k8s.io/apimachinery v0.25.2 h1:WbxfAjCx+AeN8Ilp9joWnyJ6xu9OMeS/fsfjK/5zaQs= +k8s.io/apimachinery v0.25.2/go.mod h1:hqqA1X0bsgsxI6dXsJ4HnNTBOmJNxyPp8dw3u2fSHwA= +k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= +k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= +k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU= +k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= software.sslmate.com/src/go-pkcs12 v0.0.0-20180114231543-2291e8f0f237 h1:iAEkCBPbRaflBgZ7o9gjVUuWuvWeV4sytFWg9o+Pj2k= software.sslmate.com/src/go-pkcs12 v0.0.0-20180114231543-2291e8f0f237/go.mod h1:/xvNRWUqm0+/ZMiF4EX00vrSCMsE4/NHb+Pt3freEeQ= diff --git a/test/tpp/fake/fake.go b/test/tpp/fake/fake.go index 0edd3910..58951d6c 100644 --- a/test/tpp/fake/fake.go +++ b/test/tpp/fake/fake.go @@ -5,32 +5,63 @@ import ( "encoding/json" "net/http" "net/http/httptest" + "strings" "sync" "time" - "github.com/Venafi/vcert/v4/test/tpp/fake/models" "github.com/go-logr/logr" "github.com/google/uuid" + "k8s.io/apimachinery/pkg/util/sets" + + "github.com/Venafi/vcert/v4/test/tpp/fake/models" ) -type state struct { - sync.RWMutex +type application struct { + clientID string + scope string + users sets.String +} + +type user struct { username string password string - grants map[string]models.AuthorizeOAuthResponse } -func (o *state) WithUsername(username string) *state { +type token struct { + token string + user string + expires time.Time + scope string +} + +type state struct { + sync.RWMutex + users map[string]user + applications map[string]application + grants map[string]models.AuthorizeOAuthResponse + accessTokens map[string]string +} + +func (o *state) WithUser(username, password string) *state { o.Lock() defer o.Unlock() - o.username = username + user := user{ + username: username, + password: password, + } + o.users[user.username] = user return o } -func (o *state) WithPassword(password string) *state { +func (o *state) WithApplication(clientID, scope string, users ...string) *state { o.Lock() defer o.Unlock() - o.password = password + application := application{ + clientID: clientID, + scope: scope, + users: sets.NewString(users...), + } + o.applications[application.clientID] = application return o } @@ -47,6 +78,7 @@ func (o *state) NewGrant(scope string) models.AuthorizeOAuthResponse { Identity: "", } o.grants[grant.RefreshToken] = grant + o.accessTokens[grant.AccessToken] = grant.RefreshToken return grant } @@ -58,6 +90,7 @@ func (o *state) RefreshGrant(refreshToken string) (grant models.AuthorizeOAuthRe return } delete(o.grants, refreshToken) + delete(o.accessTokens, grant.AccessToken) grant = models.AuthorizeOAuthResponse{ AccessToken: uuid.Must(uuid.NewRandom()).String(), Expires: uint64(time.Now().UTC().Add(time.Hour).Unix()), @@ -70,6 +103,22 @@ func (o *state) RefreshGrant(refreshToken string) (grant models.AuthorizeOAuthRe Identity: "", } o.grants[grant.RefreshToken] = grant + o.accessTokens[grant.AccessToken] = grant.RefreshToken + return +} + +func (o *state) LookupAccessToken(accessToken string) (grant models.AuthorizeOAuthResponse, found bool) { + o.Lock() + defer o.Unlock() + refreshToken, found := o.accessTokens[accessToken] + if !found { + return + } + grant, found = o.grants[refreshToken] + if !found { + delete(o.accessTokens, accessToken) + } + // TODO(wallrj): Check for expired tokens return } @@ -97,14 +146,17 @@ func New(log logr.Logger) *Fake { f := &Fake{ log: log, state: &state{ - grants: map[string]models.AuthorizeOAuthResponse{}, + grants: map[string]models.AuthorizeOAuthResponse{}, + accessTokens: map[string]string{}, + users: map[string]user{}, + applications: map[string]application{}, }, Server: ts, } mux.HandleFunc("/vedauth/authorize/oauth", f.handlerAuthorizeOAuth) mux.HandleFunc("/vedauth/authorize/token", f.handlerAuthorizeToken) - mux.HandleFunc("/vedsdk/Identity/Self", f.handlerIdentitySelf) - mux.HandleFunc("/vedsdk/certificates/checkpolicy", f.handlerCertificatesCheckPolicy) + mux.HandleFunc("/vedsdk/Identity/Self", f.checkBearerToken(f.handlerIdentitySelf)) + mux.HandleFunc("/vedsdk/certificates/checkpolicy", f.checkBearerToken(f.handlerCertificatesCheckPolicy)) mux.HandleFunc("/vedsdk/", f.handlerPing) mux.HandleFunc("/", f.handlerCatchAll) return f @@ -119,13 +171,34 @@ func (o *Fake) handlerAuthorizeOAuth(w http.ResponseWriter, req *http.Request) { http.Error(w, err.Error(), http.StatusInternalServerError) return } - if in.Username != o.username || in.Password != o.password { + user, found := o.users[in.Username] + if !found || in.Password != user.password { // Mimics the behavior of TPP 20.4 and above. See: // https://github.com/jetstack/venafi-oauth-helper/issues/25#issuecomment-854037706 http.Error(w, `{"error":"invalid_grant","error_description":"Username\/password combination not valid"}`, http.StatusBadRequest) return } + application, found := o.applications[in.ClientID] + if !found { + http.Error(w, `{"error":"invalid_grant","error_description":"Unknown client-id"}`, + http.StatusBadRequest) + return + } + + if !application.users.Has(in.Username) { + http.Error(w, `{"error":"invalid_grant","error_description":"Unknown client-id"}`, + http.StatusBadRequest) + return + } + + // TODO(wallrj): Check that requested scope is a subset of the application scope + // if in.Scope != application.scope { + // http.Error(w, `{"error":"invalid_grant","error_description":"scope mismatch"}`, + // http.StatusBadRequest) + // return + // } + grant := o.NewGrant(in.Scope) encoder := json.NewEncoder(w) if err := encoder.Encode(&grant); err != nil { @@ -149,6 +222,14 @@ func (o *Fake) handlerAuthorizeToken(w http.ResponseWriter, req *http.Request) { http.Error(w, "bad token", http.StatusBadRequest) return } + + _, found = o.applications[in.ClientID] + if !found { + http.Error(w, `{"error":"invalid_grant","error_description":"Unknown client-id"}`, + http.StatusBadRequest) + return + } + encoder := json.NewEncoder(w) if err := encoder.Encode(&grant); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -156,10 +237,25 @@ func (o *Fake) handlerAuthorizeToken(w http.ResponseWriter, req *http.Request) { } } +func (o *Fake) checkBearerToken(wrapped http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + authHeader := req.Header.Get("Authorization") + authParts := strings.Split(authHeader, " ") + accessToken := authParts[1] + _, found := o.LookupAccessToken(accessToken) + if !found { + http.Error(w, `{}`, http.StatusUnauthorized) + return + } + wrapped(w, req) + } +} + func (o *Fake) handlerIdentitySelf(w http.ResponseWriter, req *http.Request) { defer req.Body.Close() log := o.log.WithValues("uri", req.RequestURI).WithName("handlerIdentifySelf") log.V(1).Info("request") + out := models.IdentityWebResponse{ Identities: []*models.IdentityEntry{ &models.IdentityEntry{ diff --git a/test/tpp/fake/fake_test.go b/test/tpp/fake/fake_test.go index 484227c8..76c51c98 100644 --- a/test/tpp/fake/fake_test.go +++ b/test/tpp/fake/fake_test.go @@ -7,12 +7,12 @@ import ( "testing" "time" - "golang.org/x/sync/errgroup" - - "github.com/Venafi/vcert/v4/test/tpp/fake" "github.com/go-logr/logr" "github.com/go-logr/logr/testr" "github.com/stretchr/testify/require" + "golang.org/x/sync/errgroup" + + "github.com/Venafi/vcert/v4/test/tpp/fake" ) func TestFake(t *testing.T) { @@ -33,10 +33,22 @@ func TestFake(t *testing.T) { const ( tppUsername = "user1" tppPassword = "password1" + tppClientID = "test-application" tppZone = "zone1" ) s := fake.New(log) - s.WithUsername(tppUsername).WithPassword(tppPassword) + s.WithUser(tppUsername, tppPassword). + WithApplication( + "vcert-sdk", + "certificate:discover,manage,revoke;configuration:manage;ssh:manage", + tppUsername, + ). + WithApplication( + tppClientID, + "certificate:discover,manage,revoke", + tppUsername, + ) + s.Start(ctx) t.Cleanup(func() { s.Close(ctx) }) @@ -48,6 +60,7 @@ func TestFake(t *testing.T) { "TPP_USER="+tppUsername, "TPP_PASSWORD="+tppPassword, "TPP_ZONE="+tppZone, + "CLIENT_ID="+tppClientID, ) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr From f9f4a874dfa9a711a5650722c102e58040440086 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Fri, 30 Sep 2022 17:30:10 +0100 Subject: [PATCH 7/8] Turn off vcert trace Signed-off-by: Richard Wall --- pkg/venafi/tpp/tpp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/venafi/tpp/tpp.go b/pkg/venafi/tpp/tpp.go index ae10010b..bcd12b8a 100644 --- a/pkg/venafi/tpp/tpp.go +++ b/pkg/venafi/tpp/tpp.go @@ -461,7 +461,7 @@ func (c *Connector) request(method string, resource urlResource, data interface{ defer res.Body.Close() body, err = ioutil.ReadAll(res.Body) // Do not enable trace in production - trace := true // IMPORTANT: sensitive information can be diclosured + trace := false // IMPORTANT: sensitive information can be diclosured // I hope you know what are you doing if trace { log.Println("#################") From 1dc549e02ae6b7442eca6bb1bb62c46febeb893e Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Fri, 30 Sep 2022 18:22:49 +0100 Subject: [PATCH 8/8] Add a main entrypoint Signed-off-by: Richard Wall --- go.mod | 7 +++++ go.sum | 31 ++++++++++++++++---- test/tpp/README.md | 16 +++++++++++ test/tpp/fake/fake.go | 10 +++---- test/tpp/fake/fake_test.go | 4 +-- test/tpp/main.go | 18 ++++++++++++ test/tpp/signals/doc.go | 20 +++++++++++++ test/tpp/signals/signal.go | 45 ++++++++++++++++++++++++++++++ test/tpp/signals/signal_posix.go | 27 ++++++++++++++++++ test/tpp/signals/signal_windows.go | 23 +++++++++++++++ 10 files changed, 187 insertions(+), 14 deletions(-) create mode 100644 test/tpp/README.md create mode 100644 test/tpp/main.go create mode 100644 test/tpp/signals/doc.go create mode 100644 test/tpp/signals/signal.go create mode 100644 test/tpp/signals/signal_posix.go create mode 100644 test/tpp/signals/signal_windows.go diff --git a/go.mod b/go.mod index 63feeaba..8863ef21 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,20 @@ module github.com/Venafi/vcert/v4 require ( + github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect + github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/go-logr/logr v1.2.3 github.com/go-openapi/errors v0.20.3 github.com/go-openapi/strfmt v0.21.3 github.com/go-openapi/swag v0.22.3 github.com/google/uuid v1.1.2 github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c + github.com/mitchellh/mapstructure v1.4.1 // indirect + github.com/onsi/ginkgo v1.16.5 + github.com/onsi/gomega v1.20.1 github.com/pavel-v-chernykh/keystore-go/v4 v4.1.0 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d + github.com/spf13/afero v1.6.0 // indirect github.com/spf13/viper v1.7.0 github.com/stretchr/testify v1.8.0 github.com/urfave/cli/v2 v2.1.1 @@ -18,6 +24,7 @@ require ( gopkg.in/ini.v1 v1.51.0 gopkg.in/yaml.v2 v2.4.0 k8s.io/apimachinery v0.25.2 + k8s.io/klog/v2 v2.70.1 software.sslmate.com/src/go-pkcs12 v0.0.0-20180114231543-2291e8f0f237 ) diff --git a/go.sum b/go.sum index c9349798..b2f18dae 100644 --- a/go.sum +++ b/go.sum @@ -42,8 +42,9 @@ github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -58,8 +59,9 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -103,6 +105,7 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -174,6 +177,7 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -200,8 +204,9 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4 github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -213,19 +218,24 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= +github.com/onsi/ginkgo/v2 v2.1.6 h1:Fx2POJZfKRQcM1pH49qSZiYeu319wji004qX+GDovrU= github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q= github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pavel-v-chernykh/keystore-go/v4 v4.1.0 h1:xKxUVGoB9VJU+lgQLPN0KURjw+XCVVSpHfQEeyxk3zo= @@ -235,6 +245,7 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -250,11 +261,11 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7z github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= @@ -264,8 +275,9 @@ github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9 github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= @@ -281,6 +293,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -318,6 +331,7 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -371,6 +385,7 @@ golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -412,6 +427,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= @@ -494,6 +510,7 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -508,6 +525,7 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -533,6 +551,7 @@ k8s.io/apimachinery v0.25.2/go.mod h1:hqqA1X0bsgsxI6dXsJ4HnNTBOmJNxyPp8dw3u2fSHw k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.70.1 h1:7aaoSdahviPmR+XkS7FyxlkkXs6tHISSG03RxleQAVQ= k8s.io/klog/v2 v2.70.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1/go.mod h1:C/N6wCaBHeBHkHUesQOQy2/MZqGgMAFPqGsGQLdbZBU= k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= diff --git a/test/tpp/README.md b/test/tpp/README.md new file mode 100644 index 00000000..c1c5aa4d --- /dev/null +++ b/test/tpp/README.md @@ -0,0 +1,16 @@ +# Fake TPP Server + + +```terminal +$ go run ./test/tpp/... +I0930 18:00:58.750488 174501 main.go:15] "started" url="https://127.0.0.1:35103" + +``` + + +```terminal +$ vcert getcred --insecure -u https://127.0.0.1:45817 -t foo --verbose --username user1 --password pass1 +vCert: 2022/09/30 18:21:24 Getting credentials... +vCert: 2022/09/30 18:21:24 Got 400 Bad Request status for POST https://127.0.0.1:45817/vedauth/authorize/token +vCert: 2022/09/30 18:21:24 unexpected status code on TPP Authorize. Status: 400 Bad Request +``` diff --git a/test/tpp/fake/fake.go b/test/tpp/fake/fake.go index 58951d6c..80fdb14a 100644 --- a/test/tpp/fake/fake.go +++ b/test/tpp/fake/fake.go @@ -128,15 +128,13 @@ type Fake struct { log logr.Logger } -func (o *Fake) Start(ctx context.Context) { - log := logFromContext(ctx) - log.V(1).Info("starting") +func (o *Fake) Start() { + o.log.V(1).Info("starting") o.Server.StartTLS() } -func (o *Fake) Close(ctx context.Context) { - log := logFromContext(ctx) - log.V(1).Info("stopping") +func (o *Fake) Close() { + o.log.V(1).Info("stopping") o.Server.Close() } diff --git a/test/tpp/fake/fake_test.go b/test/tpp/fake/fake_test.go index 76c51c98..edd4bb7b 100644 --- a/test/tpp/fake/fake_test.go +++ b/test/tpp/fake/fake_test.go @@ -49,8 +49,8 @@ func TestFake(t *testing.T) { tppUsername, ) - s.Start(ctx) - t.Cleanup(func() { s.Close(ctx) }) + s.Start() + t.Cleanup(s.Close) cmd := exec.CommandContext(ctx, os.Getenv("MAKE"), "tpp_test") cmd.Dir = "../../.." diff --git a/test/tpp/main.go b/test/tpp/main.go new file mode 100644 index 00000000..5e111aef --- /dev/null +++ b/test/tpp/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "k8s.io/klog/v2" + + "github.com/Venafi/vcert/v4/test/tpp/fake" + "github.com/Venafi/vcert/v4/test/tpp/signals" +) + +func main() { + ctx := signals.SetupSignalHandler() + log := klog.NewKlogr() + tpp := fake.New(log) + tpp.Start() + log.Info("started", "url", tpp.URL) + <-ctx.Done() + tpp.Close() +} diff --git a/test/tpp/signals/doc.go b/test/tpp/signals/doc.go new file mode 100644 index 00000000..737cc7ef --- /dev/null +++ b/test/tpp/signals/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Package signals contains libraries for handling signals to gracefully +// shutdown the manager in combination with Kubernetes pod graceful termination +// policy. +package signals diff --git a/test/tpp/signals/signal.go b/test/tpp/signals/signal.go new file mode 100644 index 00000000..a79cfb42 --- /dev/null +++ b/test/tpp/signals/signal.go @@ -0,0 +1,45 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package signals + +import ( + "context" + "os" + "os/signal" +) + +var onlyOneSignalHandler = make(chan struct{}) + +// SetupSignalHandler registers for SIGTERM and SIGINT. A context is returned +// which is canceled on one of these signals. If a second signal is caught, the program +// is terminated with exit code 1. +func SetupSignalHandler() context.Context { + close(onlyOneSignalHandler) // panics when called twice + + ctx, cancel := context.WithCancel(context.Background()) + + c := make(chan os.Signal, 2) + signal.Notify(c, shutdownSignals...) + go func() { + <-c + cancel() + <-c + os.Exit(1) // second signal. Exit directly. + }() + + return ctx +} diff --git a/test/tpp/signals/signal_posix.go b/test/tpp/signals/signal_posix.go new file mode 100644 index 00000000..a0f00a73 --- /dev/null +++ b/test/tpp/signals/signal_posix.go @@ -0,0 +1,27 @@ +//go:build !windows +// +build !windows + +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package signals + +import ( + "os" + "syscall" +) + +var shutdownSignals = []os.Signal{os.Interrupt, syscall.SIGTERM} diff --git a/test/tpp/signals/signal_windows.go b/test/tpp/signals/signal_windows.go new file mode 100644 index 00000000..4907d573 --- /dev/null +++ b/test/tpp/signals/signal_windows.go @@ -0,0 +1,23 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package signals + +import ( + "os" +) + +var shutdownSignals = []os.Signal{os.Interrupt}