api: migrate to openapi generator v6 (#2968)

* migrate to openapi generator v6

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

* bump api

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
# Conflicts:
#	go.mod
#	go.sum
This commit is contained in:
Jens L 2022-05-26 15:15:30 +02:00 committed by Jens Langhammer
parent e7c03fdb14
commit d7713357f4
19 changed files with 40 additions and 37 deletions

View File

@ -65,7 +65,7 @@ gen-client-web:
docker run \ docker run \
--rm -v ${PWD}:/local \ --rm -v ${PWD}:/local \
--user ${UID}:${GID} \ --user ${UID}:${GID} \
openapitools/openapi-generator-cli:v6.0.0-beta generate \ openapitools/openapi-generator-cli:v6.0.0 generate \
-i /local/schema.yml \ -i /local/schema.yml \
-g typescript-fetch \ -g typescript-fetch \
-o /local/gen-ts-api \ -o /local/gen-ts-api \
@ -83,7 +83,7 @@ gen-client-go:
docker run \ docker run \
--rm -v ${PWD}:/local \ --rm -v ${PWD}:/local \
--user ${UID}:${GID} \ --user ${UID}:${GID} \
openapitools/openapi-generator-cli:v5.2.1 generate \ openapitools/openapi-generator-cli:v6.0.0 generate \
-i /local/schema.yml \ -i /local/schema.yml \
-g go \ -g go \
-o /local/gen-go-api \ -o /local/gen-go-api \

View File

@ -124,7 +124,7 @@ func attemptProxyStart(ws *web.WebServer, u *url.URL) {
ws.ProxyServer = srv ws.ProxyServer = srv
ac.Server = srv ac.Server = srv
l.Debug("attempting to start outpost") l.Debug("attempting to start outpost")
err := ac.StartBackgorundTasks() err := ac.StartBackgroundTasks()
if err != nil { if err != nil {
l.WithError(err).Warning("outpost failed to start") l.WithError(err).Warning("outpost failed to start")
attempt += 1 attempt += 1

6
go.mod
View File

@ -16,7 +16,7 @@ require (
github.com/gorilla/securecookie v1.1.1 github.com/gorilla/securecookie v1.1.1
github.com/gorilla/sessions v1.2.1 github.com/gorilla/sessions v1.2.1
github.com/gorilla/websocket v1.5.0 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/jellydator/ttlcache/v3 v3.0.0
github.com/nmcclain/asn1-ber v0.0.0-20170104154839-2661553a0484 github.com/nmcclain/asn1-ber v0.0.0-20170104154839-2661553a0484
github.com/nmcclain/ldap v0.0.0-20210720162743-7f8d1e44eeba 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/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b
github.com/sirupsen/logrus v1.8.1 github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.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/oauth2 v0.0.0-20220223155221-ee480838109b
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
gopkg.in/boj/redistore.v1 v1.0.0-20160128113310-fc113767cd6b 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/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/square/go-jose.v2 v2.5.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
) )

13
go.sum
View File

@ -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.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/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/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.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= 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/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 h1:zmFhqrB/4sKiEiJHhtseJsNRE32IMVmJSs4++4gaQO4=
github.com/jellydator/ttlcache/v3 v3.0.0/go.mod h1:WwTaEmcXQ3MTjOm4bsZoDFiCu/hMvNWLO1w67RXz6h4= 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.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/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= 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.5 h1:kaW52rZZE+wUsp47Ab9OBaLCPNGbqQkCrQWkrbzy14Q=
goauthentik.io/api/v3 v3.2022052.2/go.mod h1:QM9J32HgYE4gL71lWAfAoXSPdSmLVLW08itfLI3Mo10= 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-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-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= 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-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-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-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-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-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-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-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

View File

@ -27,7 +27,7 @@ const ConfigLogLevel = "log_level"
type APIController struct { type APIController struct {
Client *api.APIClient Client *api.APIClient
Outpost api.Outpost Outpost api.Outpost
GlobalConfig api.Config GlobalConfig *api.Config
Server Outpost Server Outpost
@ -113,7 +113,7 @@ func (a *APIController) Start() error {
if err != nil { if err != nil {
return err return err
} }
err = a.StartBackgorundTasks() err = a.StartBackgroundTasks()
if err != nil { if err != nil {
return err return err
} }
@ -165,7 +165,7 @@ func (a *APIController) OnRefresh() error {
return err return err
} }
func (a *APIController) StartBackgorundTasks() error { func (a *APIController) StartBackgroundTasks() error {
OutpostInfo.With(prometheus.Labels{ OutpostInfo.With(prometheus.Labels{
"outpost_name": a.Outpost.Name, "outpost_name": a.Outpost.Name,
"outpost_type": a.Server.Type(), "outpost_type": a.Server.Type(),

View File

@ -15,7 +15,7 @@ import (
var initialSetup = false 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") l := log.WithField("logger", "authentik.outpost")
m := outpost.Managed.Get() m := outpost.Managed.Get()
level, ok := outpost.Config[ConfigLogLevel] level, ok := outpost.Config[ConfigLogLevel]

View File

@ -50,7 +50,7 @@ func MockAK(outpost api.Outpost, globalConfig api.Config) *APIController {
ac := &APIController{ ac := &APIController{
Client: apiClient, Client: apiClient,
GlobalConfig: globalConfig, GlobalConfig: &globalConfig,
token: token, token: token,
logger: log, logger: log,

View File

@ -149,7 +149,7 @@ func (ds *DirectSearcher) Search(req *search.Request) (ldap.ServerSearchResult,
return fmt.Errorf("failed to get userinfo") return fmt.Errorf("failed to get userinfo")
} }
flags.UserInfo = &u flags.UserInfo = u
} }
u := make([]api.User, 1) u := make([]api.User, 1)

View File

@ -16,7 +16,7 @@ func (ms *MemorySearcher) FetchUsers() []api.User {
return nil, err return nil, err
} }
ms.log.WithField("page", page).WithField("count", len(users.Results)).Debug("fetched users") ms.log.WithField("page", page).WithField("count", len(users.Results)).Debug("fetched users")
return &users, nil return users, nil
} }
page := 1 page := 1
users := make([]api.User, 0) users := make([]api.User, 0)
@ -43,7 +43,7 @@ func (ms *MemorySearcher) FetchGroups() []api.Group {
return nil, err return nil, err
} }
ms.log.WithField("page", page).WithField("count", len(groups.Results)).Debug("fetched groups") ms.log.WithField("page", page).WithField("count", len(groups.Results)).Debug("fetched groups")
return &groups, nil return groups, nil
} }
page := 1 page := 1
groups := make([]api.Group, 0) groups := make([]api.Group, 0)

View File

@ -141,7 +141,7 @@ func (ms *MemorySearcher) Search(req *search.Request) (ldap.ServerSearchResult,
if flags.UserPk == u.Pk { if flags.UserPk == u.Pk {
//TODO: Is there a better way to clone this object? //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 := 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) fg.SetIsSuperuser(*g.IsSuperuser)
groups = append(groups, group.FromAPIGroup(*fg, ms.si)) groups = append(groups, group.FromAPIGroup(*fg, ms.si))
break break

View File

@ -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/sign_in", a.handleRedirect)
mux.HandleFunc("/outpost.goauthentik.io/callback", a.handleCallback) mux.HandleFunc("/outpost.goauthentik.io/callback", a.handleCallback)
mux.HandleFunc("/outpost.goauthentik.io/sign_out", a.handleSignOut) mux.HandleFunc("/outpost.goauthentik.io/sign_out", a.handleSignOut)
switch *p.Mode { switch *p.Mode.Get() {
case api.PROXYMODE_PROXY: case api.PROXYMODE_PROXY:
err = a.configureProxy() err = a.configureProxy()
case api.PROXYMODE_FORWARD_SINGLE: 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 { func (a *Application) Mode() api.ProxyMode {
return *a.proxyConfig.Mode return *a.proxyConfig.Mode.Get()
} }
func (a *Application) ProxyConfig() api.ProxyOutpostConfig { func (a *Application) ProxyConfig() api.ProxyOutpostConfig {

View File

@ -107,7 +107,7 @@ func (a *Application) ReportMisconfiguration(r *http.Request, msg string, fields
Action: api.EVENTACTIONS_CONFIGURATION_ERROR, Action: api.EVENTACTIONS_CONFIGURATION_ERROR,
App: "authentik.providers.proxy", // must match python apps.py name App: "authentik.providers.proxy", // must match python apps.py name
ClientIp: *api.NewNullableString(api.PtrString(r.RemoteAddr)), ClientIp: *api.NewNullableString(api.PtrString(r.RemoteAddr)),
Context: &fields, Context: fields,
} }
_, _, err := a.ak.Client.EventsApi.EventsEventsCreate(context.Background()).EventRequest(req).Execute() _, _, err := a.ak.Client.EventsApi.EventsEventsCreate(context.Background()).EventRequest(req).Execute()
if err != nil { if err != nil {

View File

@ -19,7 +19,7 @@ func urlMustParse(u string) *url.URL {
func TestIsAllowlisted_Proxy_Single(t *testing.T) { func TestIsAllowlisted_Proxy_Single(t *testing.T) {
a := newTestApplication() 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(""))) assert.Equal(t, false, a.IsAllowlisted(urlMustParse("")))
a.UnauthenticatedRegex = []*regexp.Regexp{ a.UnauthenticatedRegex = []*regexp.Regexp{
@ -30,7 +30,7 @@ func TestIsAllowlisted_Proxy_Single(t *testing.T) {
func TestIsAllowlisted_Proxy_Domain(t *testing.T) { func TestIsAllowlisted_Proxy_Domain(t *testing.T) {
a := newTestApplication() 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(""))) assert.Equal(t, false, a.IsAllowlisted(urlMustParse("")))
a.UnauthenticatedRegex = []*regexp.Regexp{ a.UnauthenticatedRegex = []*regexp.Regexp{

View File

@ -56,9 +56,9 @@ func (a *Application) forwardHandleTraefik(rw http.ResponseWriter, r *http.Reque
host := "" host := ""
s, _ := a.sessions.Get(r, constants.SessionName) s, _ := a.sessions.Get(r, constants.SessionName)
// Optional suffix, which is appended to the URL // 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) 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) eh, err := url.Parse(a.proxyConfig.ExternalHost)
if err != nil { if err != nil {
a.log.WithField("host", a.proxyConfig.ExternalHost).WithError(err).Warning("invalid external_host") a.log.WithField("host", a.proxyConfig.ExternalHost).WithError(err).Warning("invalid external_host")

View File

@ -106,7 +106,7 @@ func TestForwardHandleNginx_Single_Claims(t *testing.T) {
func TestForwardHandleNginx_Domain_Blank(t *testing.T) { func TestForwardHandleNginx_Domain_Blank(t *testing.T) {
a := newTestApplication() 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.CookieDomain = api.PtrString("foo")
req, _ := http.NewRequest("GET", "/outpost.goauthentik.io/auth/nginx", nil) 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) { func TestForwardHandleNginx_Domain_Header(t *testing.T) {
a := newTestApplication() 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.CookieDomain = api.PtrString("foo")
a.proxyConfig.ExternalHost = "http://auth.test.goauthentik.io" a.proxyConfig.ExternalHost = "http://auth.test.goauthentik.io"
req, _ := http.NewRequest("GET", "/outpost.goauthentik.io/auth/nginx", nil) req, _ := http.NewRequest("GET", "/outpost.goauthentik.io/auth/nginx", nil)

View File

@ -100,7 +100,7 @@ func TestForwardHandleTraefik_Single_Claims(t *testing.T) {
func TestForwardHandleTraefik_Domain_Blank(t *testing.T) { func TestForwardHandleTraefik_Domain_Blank(t *testing.T) {
a := newTestApplication() 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.CookieDomain = api.PtrString("foo")
req, _ := http.NewRequest("GET", "/outpost.goauthentik.io/auth/traefik", nil) 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) { func TestForwardHandleTraefik_Domain_Header(t *testing.T) {
a := newTestApplication() 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.CookieDomain = api.PtrString("foo")
a.proxyConfig.ExternalHost = "http://auth.test.goauthentik.io" a.proxyConfig.ExternalHost = "http://auth.test.goauthentik.io"
req, _ := http.NewRequest("GET", "/outpost.goauthentik.io/auth/traefik", nil) req, _ := http.NewRequest("GET", "/outpost.goauthentik.io/auth/traefik", nil)

View File

@ -34,7 +34,7 @@ func TestCheckRedirectParam(t *testing.T) {
func TestCheckRedirectParam_Domain(t *testing.T) { func TestCheckRedirectParam_Domain(t *testing.T) {
a := newTestApplication() 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") a.proxyConfig.CookieDomain = api.PtrString("t.goauthentik.io")
req, _ := http.NewRequest("GET", "https://a.t.goauthentik.io/outpost.goauthentik.io/auth/start", nil) req, _ := http.NewRequest("GET", "https://a.t.goauthentik.io/outpost.goauthentik.io/auth/start", nil)

View File

@ -17,7 +17,7 @@ func newTestApplication() *Application {
CookieSecret: api.PtrString(ak.TestSecret()), CookieSecret: api.PtrString(ak.TestSecret()),
ExternalHost: "https://ext.t.goauthentik.io", ExternalHost: "https://ext.t.goauthentik.io",
CookieDomain: api.PtrString(""), CookieDomain: api.PtrString(""),
Mode: api.PROXYMODE_FORWARD_SINGLE.Ptr(), Mode: *api.NewNullableProxyMode(api.PROXYMODE_FORWARD_SINGLE.Ptr()),
SkipPathRegex: api.PtrString("/skip.*"), SkipPathRegex: api.PtrString("/skip.*"),
BasicAuthEnabled: api.PtrBool(true), BasicAuthEnabled: api.PtrBool(true),
BasicAuthUserAttribute: api.PtrString("username"), BasicAuthUserAttribute: api.PtrString("username"),

View File

@ -12,7 +12,7 @@ import (
func TestRedirectToStart_Proxy(t *testing.T) { func TestRedirectToStart_Proxy(t *testing.T) {
a := newTestApplication() 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" a.proxyConfig.ExternalHost = "https://test.goauthentik.io"
req, _ := http.NewRequest("GET", "/foo/bar/baz", nil) req, _ := http.NewRequest("GET", "/foo/bar/baz", nil)
@ -29,7 +29,7 @@ func TestRedirectToStart_Proxy(t *testing.T) {
func TestRedirectToStart_Forward(t *testing.T) { func TestRedirectToStart_Forward(t *testing.T) {
a := newTestApplication() 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" a.proxyConfig.ExternalHost = "https://test.goauthentik.io"
req, _ := http.NewRequest("GET", "/foo/bar/baz", nil) 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) { func TestRedirectToStart_Forward_Domain_Invalid(t *testing.T) {
a := newTestApplication() a := newTestApplication()
a.proxyConfig.CookieDomain = api.PtrString("foo") 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" a.proxyConfig.ExternalHost = "https://test.goauthentik.io"
req, _ := http.NewRequest("GET", "/foo/bar/baz", nil) 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) { func TestRedirectToStart_Forward_Domain(t *testing.T) {
a := newTestApplication() a := newTestApplication()
a.proxyConfig.CookieDomain = api.PtrString("goauthentik.io") 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" a.proxyConfig.ExternalHost = "https://test.goauthentik.io"
req, _ := http.NewRequest("GET", "/foo/bar/baz", nil) req, _ := http.NewRequest("GET", "/foo/bar/baz", nil)