From d7713357f4322f344838c3662b5824674b54f6cb Mon Sep 17 00:00:00 2001 From: Jens L Date: Thu, 26 May 2022 15:15:30 +0200 Subject: [PATCH] api: migrate to openapi generator v6 (#2968) * migrate to openapi generator v6 Signed-off-by: Jens Langhammer * bump api Signed-off-by: Jens Langhammer # Conflicts: # go.mod # go.sum --- Makefile | 4 ++-- cmd/server/main.go | 2 +- go.mod | 6 +++--- go.sum | 13 ++++++++----- internal/outpost/ak/api.go | 6 +++--- internal/outpost/ak/global.go | 2 +- internal/outpost/ak/test.go | 2 +- internal/outpost/ldap/search/direct/direct.go | 2 +- internal/outpost/ldap/search/memory/fetch.go | 4 ++-- internal/outpost/ldap/search/memory/memory.go | 2 +- internal/outpost/proxyv2/application/application.go | 4 ++-- internal/outpost/proxyv2/application/mode_common.go | 2 +- .../outpost/proxyv2/application/mode_common_test.go | 4 ++-- .../outpost/proxyv2/application/mode_forward.go | 4 ++-- .../proxyv2/application/mode_forward_nginx_test.go | 4 ++-- .../application/mode_forward_traefik_test.go | 4 ++-- internal/outpost/proxyv2/application/oauth_test.go | 2 +- internal/outpost/proxyv2/application/test.go | 2 +- internal/outpost/proxyv2/application/utils_test.go | 8 ++++---- 19 files changed, 40 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 5eae011a5..cf690d661 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ gen-client-web: docker run \ --rm -v ${PWD}:/local \ --user ${UID}:${GID} \ - openapitools/openapi-generator-cli:v6.0.0-beta generate \ + openapitools/openapi-generator-cli:v6.0.0 generate \ -i /local/schema.yml \ -g typescript-fetch \ -o /local/gen-ts-api \ @@ -83,7 +83,7 @@ gen-client-go: docker run \ --rm -v ${PWD}:/local \ --user ${UID}:${GID} \ - openapitools/openapi-generator-cli:v5.2.1 generate \ + openapitools/openapi-generator-cli:v6.0.0 generate \ -i /local/schema.yml \ -g go \ -o /local/gen-go-api \ diff --git a/cmd/server/main.go b/cmd/server/main.go index cf32124d0..583925b3a 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -124,7 +124,7 @@ func attemptProxyStart(ws *web.WebServer, u *url.URL) { ws.ProxyServer = srv ac.Server = srv l.Debug("attempting to start outpost") - err := ac.StartBackgorundTasks() + err := ac.StartBackgroundTasks() if err != nil { l.WithError(err).Warning("outpost failed to start") attempt += 1 diff --git a/go.mod b/go.mod index 467492a39..a2d2d5e1e 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/gorilla/securecookie v1.1.1 github.com/gorilla/sessions v1.2.1 github.com/gorilla/websocket v1.5.0 - github.com/imdario/mergo v0.3.12 + github.com/imdario/mergo v0.3.13 github.com/jellydator/ttlcache/v3 v3.0.0 github.com/nmcclain/asn1-ber v0.0.0-20170104154839-2661553a0484 github.com/nmcclain/ldap v0.0.0-20210720162743-7f8d1e44eeba @@ -26,7 +26,7 @@ require ( github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.1 - goauthentik.io/api/v3 v3.2022052.2 + goauthentik.io/api/v3 v3.2022052.6 golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b golang.org/x/sync v0.0.0-20210220032951-036812b2e83c gopkg.in/boj/redistore.v1 v1.0.0-20160128113310-fc113767cd6b @@ -73,5 +73,5 @@ require ( google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.27.1 // indirect gopkg.in/square/go-jose.v2 v2.5.1 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.0 // indirect ) diff --git a/go.sum b/go.sum index 0cb4e38d4..6ca4490a7 100644 --- a/go.sum +++ b/go.sum @@ -221,8 +221,8 @@ github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jellydator/ttlcache/v3 v3.0.0 h1:zmFhqrB/4sKiEiJHhtseJsNRE32IMVmJSs4++4gaQO4= github.com/jellydator/ttlcache/v3 v3.0.0/go.mod h1:WwTaEmcXQ3MTjOm4bsZoDFiCu/hMvNWLO1w67RXz6h4= @@ -358,8 +358,10 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= -goauthentik.io/api/v3 v3.2022052.2 h1:fw5L8m9dy3NqjbTJfnqslo3zfLaF2ZEYx9bJnpqV0Yk= -goauthentik.io/api/v3 v3.2022052.2/go.mod h1:QM9J32HgYE4gL71lWAfAoXSPdSmLVLW08itfLI3Mo10= +goauthentik.io/api/v3 v3.2022052.5 h1:kaW52rZZE+wUsp47Ab9OBaLCPNGbqQkCrQWkrbzy14Q= +goauthentik.io/api/v3 v3.2022052.5/go.mod h1:QM9J32HgYE4gL71lWAfAoXSPdSmLVLW08itfLI3Mo10= +goauthentik.io/api/v3 v3.2022052.6 h1:NF9WLbWWcqOViPhYbJoUUdILnXtOYJrjFmHHqL513wY= +goauthentik.io/api/v3 v3.2022052.6/go.mod h1:QM9J32HgYE4gL71lWAfAoXSPdSmLVLW08itfLI3Mo10= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= @@ -667,8 +669,9 @@ 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 h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= +gopkg.in/yaml.v3 v3.0.0/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/internal/outpost/ak/api.go b/internal/outpost/ak/api.go index 6cce5b579..5b495d8c0 100644 --- a/internal/outpost/ak/api.go +++ b/internal/outpost/ak/api.go @@ -27,7 +27,7 @@ const ConfigLogLevel = "log_level" type APIController struct { Client *api.APIClient Outpost api.Outpost - GlobalConfig api.Config + GlobalConfig *api.Config Server Outpost @@ -113,7 +113,7 @@ func (a *APIController) Start() error { if err != nil { return err } - err = a.StartBackgorundTasks() + err = a.StartBackgroundTasks() if err != nil { return err } @@ -165,7 +165,7 @@ func (a *APIController) OnRefresh() error { return err } -func (a *APIController) StartBackgorundTasks() error { +func (a *APIController) StartBackgroundTasks() error { OutpostInfo.With(prometheus.Labels{ "outpost_name": a.Outpost.Name, "outpost_type": a.Server.Type(), diff --git a/internal/outpost/ak/global.go b/internal/outpost/ak/global.go index 10bd9cca9..154ce4a0d 100644 --- a/internal/outpost/ak/global.go +++ b/internal/outpost/ak/global.go @@ -15,7 +15,7 @@ import ( var initialSetup = false -func doGlobalSetup(outpost api.Outpost, globalConfig api.Config) { +func doGlobalSetup(outpost api.Outpost, globalConfig *api.Config) { l := log.WithField("logger", "authentik.outpost") m := outpost.Managed.Get() level, ok := outpost.Config[ConfigLogLevel] diff --git a/internal/outpost/ak/test.go b/internal/outpost/ak/test.go index 50a54f6c2..7b9f4e832 100644 --- a/internal/outpost/ak/test.go +++ b/internal/outpost/ak/test.go @@ -50,7 +50,7 @@ func MockAK(outpost api.Outpost, globalConfig api.Config) *APIController { ac := &APIController{ Client: apiClient, - GlobalConfig: globalConfig, + GlobalConfig: &globalConfig, token: token, logger: log, diff --git a/internal/outpost/ldap/search/direct/direct.go b/internal/outpost/ldap/search/direct/direct.go index 88063815d..d1bae4354 100644 --- a/internal/outpost/ldap/search/direct/direct.go +++ b/internal/outpost/ldap/search/direct/direct.go @@ -149,7 +149,7 @@ func (ds *DirectSearcher) Search(req *search.Request) (ldap.ServerSearchResult, return fmt.Errorf("failed to get userinfo") } - flags.UserInfo = &u + flags.UserInfo = u } u := make([]api.User, 1) diff --git a/internal/outpost/ldap/search/memory/fetch.go b/internal/outpost/ldap/search/memory/fetch.go index b8b6d1ba8..a18dfbcb7 100644 --- a/internal/outpost/ldap/search/memory/fetch.go +++ b/internal/outpost/ldap/search/memory/fetch.go @@ -16,7 +16,7 @@ func (ms *MemorySearcher) FetchUsers() []api.User { return nil, err } ms.log.WithField("page", page).WithField("count", len(users.Results)).Debug("fetched users") - return &users, nil + return users, nil } page := 1 users := make([]api.User, 0) @@ -43,7 +43,7 @@ func (ms *MemorySearcher) FetchGroups() []api.Group { return nil, err } ms.log.WithField("page", page).WithField("count", len(groups.Results)).Debug("fetched groups") - return &groups, nil + return groups, nil } page := 1 groups := make([]api.Group, 0) diff --git a/internal/outpost/ldap/search/memory/memory.go b/internal/outpost/ldap/search/memory/memory.go index 7403fe20c..200680b7a 100644 --- a/internal/outpost/ldap/search/memory/memory.go +++ b/internal/outpost/ldap/search/memory/memory.go @@ -141,7 +141,7 @@ func (ms *MemorySearcher) Search(req *search.Request) (ldap.ServerSearchResult, if flags.UserPk == u.Pk { //TODO: Is there a better way to clone this object? fg := api.NewGroup(g.Pk, g.NumPk, g.Name, g.Parent, g.ParentName, []int32{flags.UserPk}, []api.GroupMember{u}) - fg.SetAttributes(*g.Attributes) + fg.SetAttributes(g.Attributes) fg.SetIsSuperuser(*g.IsSuperuser) groups = append(groups, group.FromAPIGroup(*fg, ms.si)) break diff --git a/internal/outpost/proxyv2/application/application.go b/internal/outpost/proxyv2/application/application.go index 7b8cffed7..14583897b 100644 --- a/internal/outpost/proxyv2/application/application.go +++ b/internal/outpost/proxyv2/application/application.go @@ -149,7 +149,7 @@ func NewApplication(p api.ProxyOutpostConfig, c *http.Client, cs *ak.CryptoStore mux.HandleFunc("/outpost.goauthentik.io/sign_in", a.handleRedirect) mux.HandleFunc("/outpost.goauthentik.io/callback", a.handleCallback) mux.HandleFunc("/outpost.goauthentik.io/sign_out", a.handleSignOut) - switch *p.Mode { + switch *p.Mode.Get() { case api.PROXYMODE_PROXY: err = a.configureProxy() case api.PROXYMODE_FORWARD_SINGLE: @@ -186,7 +186,7 @@ func NewApplication(p api.ProxyOutpostConfig, c *http.Client, cs *ak.CryptoStore } func (a *Application) Mode() api.ProxyMode { - return *a.proxyConfig.Mode + return *a.proxyConfig.Mode.Get() } func (a *Application) ProxyConfig() api.ProxyOutpostConfig { diff --git a/internal/outpost/proxyv2/application/mode_common.go b/internal/outpost/proxyv2/application/mode_common.go index a74831494..9f24a192e 100644 --- a/internal/outpost/proxyv2/application/mode_common.go +++ b/internal/outpost/proxyv2/application/mode_common.go @@ -107,7 +107,7 @@ func (a *Application) ReportMisconfiguration(r *http.Request, msg string, fields Action: api.EVENTACTIONS_CONFIGURATION_ERROR, App: "authentik.providers.proxy", // must match python apps.py name ClientIp: *api.NewNullableString(api.PtrString(r.RemoteAddr)), - Context: &fields, + Context: fields, } _, _, err := a.ak.Client.EventsApi.EventsEventsCreate(context.Background()).EventRequest(req).Execute() if err != nil { diff --git a/internal/outpost/proxyv2/application/mode_common_test.go b/internal/outpost/proxyv2/application/mode_common_test.go index a258cf17d..fc553b644 100644 --- a/internal/outpost/proxyv2/application/mode_common_test.go +++ b/internal/outpost/proxyv2/application/mode_common_test.go @@ -19,7 +19,7 @@ func urlMustParse(u string) *url.URL { func TestIsAllowlisted_Proxy_Single(t *testing.T) { a := newTestApplication() - a.proxyConfig.Mode = api.PROXYMODE_PROXY.Ptr() + a.proxyConfig.Mode = *api.NewNullableProxyMode(api.PROXYMODE_PROXY.Ptr()) assert.Equal(t, false, a.IsAllowlisted(urlMustParse(""))) a.UnauthenticatedRegex = []*regexp.Regexp{ @@ -30,7 +30,7 @@ func TestIsAllowlisted_Proxy_Single(t *testing.T) { func TestIsAllowlisted_Proxy_Domain(t *testing.T) { a := newTestApplication() - a.proxyConfig.Mode = api.PROXYMODE_FORWARD_DOMAIN.Ptr() + a.proxyConfig.Mode = *api.NewNullableProxyMode(api.PROXYMODE_FORWARD_DOMAIN.Ptr()) assert.Equal(t, false, a.IsAllowlisted(urlMustParse(""))) a.UnauthenticatedRegex = []*regexp.Regexp{ diff --git a/internal/outpost/proxyv2/application/mode_forward.go b/internal/outpost/proxyv2/application/mode_forward.go index 740cd428f..d61522cfe 100644 --- a/internal/outpost/proxyv2/application/mode_forward.go +++ b/internal/outpost/proxyv2/application/mode_forward.go @@ -56,9 +56,9 @@ func (a *Application) forwardHandleTraefik(rw http.ResponseWriter, r *http.Reque host := "" s, _ := a.sessions.Get(r, constants.SessionName) // Optional suffix, which is appended to the URL - if *a.proxyConfig.Mode == api.PROXYMODE_FORWARD_SINGLE { + if *a.proxyConfig.Mode.Get() == api.PROXYMODE_FORWARD_SINGLE { host = web.GetHost(r) - } else if *a.proxyConfig.Mode == api.PROXYMODE_FORWARD_DOMAIN { + } else if *a.proxyConfig.Mode.Get() == api.PROXYMODE_FORWARD_DOMAIN { eh, err := url.Parse(a.proxyConfig.ExternalHost) if err != nil { a.log.WithField("host", a.proxyConfig.ExternalHost).WithError(err).Warning("invalid external_host") diff --git a/internal/outpost/proxyv2/application/mode_forward_nginx_test.go b/internal/outpost/proxyv2/application/mode_forward_nginx_test.go index 5bc83538a..a23a0be71 100644 --- a/internal/outpost/proxyv2/application/mode_forward_nginx_test.go +++ b/internal/outpost/proxyv2/application/mode_forward_nginx_test.go @@ -106,7 +106,7 @@ func TestForwardHandleNginx_Single_Claims(t *testing.T) { func TestForwardHandleNginx_Domain_Blank(t *testing.T) { a := newTestApplication() - a.proxyConfig.Mode = api.PROXYMODE_FORWARD_DOMAIN.Ptr() + a.proxyConfig.Mode = *api.NewNullableProxyMode(api.PROXYMODE_FORWARD_DOMAIN.Ptr()) a.proxyConfig.CookieDomain = api.PtrString("foo") req, _ := http.NewRequest("GET", "/outpost.goauthentik.io/auth/nginx", nil) @@ -118,7 +118,7 @@ func TestForwardHandleNginx_Domain_Blank(t *testing.T) { func TestForwardHandleNginx_Domain_Header(t *testing.T) { a := newTestApplication() - a.proxyConfig.Mode = api.PROXYMODE_FORWARD_DOMAIN.Ptr() + a.proxyConfig.Mode = *api.NewNullableProxyMode(api.PROXYMODE_FORWARD_DOMAIN.Ptr()) a.proxyConfig.CookieDomain = api.PtrString("foo") a.proxyConfig.ExternalHost = "http://auth.test.goauthentik.io" req, _ := http.NewRequest("GET", "/outpost.goauthentik.io/auth/nginx", nil) diff --git a/internal/outpost/proxyv2/application/mode_forward_traefik_test.go b/internal/outpost/proxyv2/application/mode_forward_traefik_test.go index 038c07f08..8d22b12ed 100644 --- a/internal/outpost/proxyv2/application/mode_forward_traefik_test.go +++ b/internal/outpost/proxyv2/application/mode_forward_traefik_test.go @@ -100,7 +100,7 @@ func TestForwardHandleTraefik_Single_Claims(t *testing.T) { func TestForwardHandleTraefik_Domain_Blank(t *testing.T) { a := newTestApplication() - a.proxyConfig.Mode = api.PROXYMODE_FORWARD_DOMAIN.Ptr() + a.proxyConfig.Mode = *api.NewNullableProxyMode(api.PROXYMODE_FORWARD_DOMAIN.Ptr()) a.proxyConfig.CookieDomain = api.PtrString("foo") req, _ := http.NewRequest("GET", "/outpost.goauthentik.io/auth/traefik", nil) @@ -112,7 +112,7 @@ func TestForwardHandleTraefik_Domain_Blank(t *testing.T) { func TestForwardHandleTraefik_Domain_Header(t *testing.T) { a := newTestApplication() - a.proxyConfig.Mode = api.PROXYMODE_FORWARD_DOMAIN.Ptr() + a.proxyConfig.Mode = *api.NewNullableProxyMode(api.PROXYMODE_FORWARD_DOMAIN.Ptr()) a.proxyConfig.CookieDomain = api.PtrString("foo") a.proxyConfig.ExternalHost = "http://auth.test.goauthentik.io" req, _ := http.NewRequest("GET", "/outpost.goauthentik.io/auth/traefik", nil) diff --git a/internal/outpost/proxyv2/application/oauth_test.go b/internal/outpost/proxyv2/application/oauth_test.go index 79e84382d..c68e882da 100644 --- a/internal/outpost/proxyv2/application/oauth_test.go +++ b/internal/outpost/proxyv2/application/oauth_test.go @@ -34,7 +34,7 @@ func TestCheckRedirectParam(t *testing.T) { func TestCheckRedirectParam_Domain(t *testing.T) { a := newTestApplication() - a.proxyConfig.Mode = api.PROXYMODE_FORWARD_DOMAIN.Ptr() + a.proxyConfig.Mode = *api.NewNullableProxyMode(api.PROXYMODE_FORWARD_DOMAIN.Ptr()) a.proxyConfig.CookieDomain = api.PtrString("t.goauthentik.io") req, _ := http.NewRequest("GET", "https://a.t.goauthentik.io/outpost.goauthentik.io/auth/start", nil) diff --git a/internal/outpost/proxyv2/application/test.go b/internal/outpost/proxyv2/application/test.go index e5f397769..74787114a 100644 --- a/internal/outpost/proxyv2/application/test.go +++ b/internal/outpost/proxyv2/application/test.go @@ -17,7 +17,7 @@ func newTestApplication() *Application { CookieSecret: api.PtrString(ak.TestSecret()), ExternalHost: "https://ext.t.goauthentik.io", CookieDomain: api.PtrString(""), - Mode: api.PROXYMODE_FORWARD_SINGLE.Ptr(), + Mode: *api.NewNullableProxyMode(api.PROXYMODE_FORWARD_SINGLE.Ptr()), SkipPathRegex: api.PtrString("/skip.*"), BasicAuthEnabled: api.PtrBool(true), BasicAuthUserAttribute: api.PtrString("username"), diff --git a/internal/outpost/proxyv2/application/utils_test.go b/internal/outpost/proxyv2/application/utils_test.go index d1ac8957b..252d9af51 100644 --- a/internal/outpost/proxyv2/application/utils_test.go +++ b/internal/outpost/proxyv2/application/utils_test.go @@ -12,7 +12,7 @@ import ( func TestRedirectToStart_Proxy(t *testing.T) { a := newTestApplication() - a.proxyConfig.Mode = api.PROXYMODE_PROXY.Ptr() + a.proxyConfig.Mode = *api.NewNullableProxyMode(api.PROXYMODE_PROXY.Ptr()) a.proxyConfig.ExternalHost = "https://test.goauthentik.io" req, _ := http.NewRequest("GET", "/foo/bar/baz", nil) @@ -29,7 +29,7 @@ func TestRedirectToStart_Proxy(t *testing.T) { func TestRedirectToStart_Forward(t *testing.T) { a := newTestApplication() - a.proxyConfig.Mode = api.PROXYMODE_FORWARD_SINGLE.Ptr() + a.proxyConfig.Mode = *api.NewNullableProxyMode(api.PROXYMODE_FORWARD_SINGLE.Ptr()) a.proxyConfig.ExternalHost = "https://test.goauthentik.io" req, _ := http.NewRequest("GET", "/foo/bar/baz", nil) @@ -47,7 +47,7 @@ func TestRedirectToStart_Forward(t *testing.T) { func TestRedirectToStart_Forward_Domain_Invalid(t *testing.T) { a := newTestApplication() a.proxyConfig.CookieDomain = api.PtrString("foo") - a.proxyConfig.Mode = api.PROXYMODE_FORWARD_DOMAIN.Ptr() + a.proxyConfig.Mode = *api.NewNullableProxyMode(api.PROXYMODE_FORWARD_DOMAIN.Ptr()) a.proxyConfig.ExternalHost = "https://test.goauthentik.io" req, _ := http.NewRequest("GET", "/foo/bar/baz", nil) @@ -65,7 +65,7 @@ func TestRedirectToStart_Forward_Domain_Invalid(t *testing.T) { func TestRedirectToStart_Forward_Domain(t *testing.T) { a := newTestApplication() a.proxyConfig.CookieDomain = api.PtrString("goauthentik.io") - a.proxyConfig.Mode = api.PROXYMODE_FORWARD_DOMAIN.Ptr() + a.proxyConfig.Mode = *api.NewNullableProxyMode(api.PROXYMODE_FORWARD_DOMAIN.Ptr()) a.proxyConfig.ExternalHost = "https://test.goauthentik.io" req, _ := http.NewRequest("GET", "/foo/bar/baz", nil)