diff --git a/internal/outpost/proxyv2/application/claims.go b/internal/outpost/proxyv2/application/claims.go index 15af36eb2..e806610b7 100644 --- a/internal/outpost/proxyv2/application/claims.go +++ b/internal/outpost/proxyv2/application/claims.go @@ -6,14 +6,14 @@ type ProxyClaims struct { } type Claims struct { - Sub string `json:"sub"` - Exp int `json:"exp"` - Email string `json:"email"` - Verified bool `json:"email_verified"` - Proxy ProxyClaims `json:"ak_proxy"` - Name string `json:"name"` - PreferredUsername string `json:"preferred_username"` - Groups []string `json:"groups"` + Sub string `json:"sub"` + Exp int `json:"exp"` + Email string `json:"email"` + Verified bool `json:"email_verified"` + Proxy *ProxyClaims `json:"ak_proxy"` + Name string `json:"name"` + PreferredUsername string `json:"preferred_username"` + Groups []string `json:"groups"` RawToken string } diff --git a/internal/outpost/proxyv2/application/mode_forward_nginx_test.go b/internal/outpost/proxyv2/application/mode_forward_nginx_test.go index f25e293f1..58873fc15 100644 --- a/internal/outpost/proxyv2/application/mode_forward_nginx_test.go +++ b/internal/outpost/proxyv2/application/mode_forward_nginx_test.go @@ -70,7 +70,7 @@ func TestForwardHandleNginx_Single_Claims(t *testing.T) { s, _ := a.sessions.Get(req, constants.SeesionName) s.Values[constants.SessionClaims] = Claims{ Sub: "foo", - Proxy: ProxyClaims{ + Proxy: &ProxyClaims{ UserAttributes: map[string]interface{}{ "username": "foo", "password": "bar", diff --git a/internal/outpost/proxyv2/application/mode_forward_traefik_test.go b/internal/outpost/proxyv2/application/mode_forward_traefik_test.go index fbca244be..e9abe5259 100644 --- a/internal/outpost/proxyv2/application/mode_forward_traefik_test.go +++ b/internal/outpost/proxyv2/application/mode_forward_traefik_test.go @@ -64,7 +64,7 @@ func TestForwardHandleTraefik_Single_Claims(t *testing.T) { s, _ := a.sessions.Get(req, constants.SeesionName) s.Values[constants.SessionClaims] = Claims{ Sub: "foo", - Proxy: ProxyClaims{ + Proxy: &ProxyClaims{ UserAttributes: map[string]interface{}{ "username": "foo", "password": "bar", diff --git a/internal/outpost/proxyv2/application/mode_proxy.go b/internal/outpost/proxyv2/application/mode_proxy.go index 746861dc5..db61eeee5 100644 --- a/internal/outpost/proxyv2/application/mode_proxy.go +++ b/internal/outpost/proxyv2/application/mode_proxy.go @@ -74,7 +74,7 @@ func (a *Application) configureProxy() error { func (a *Application) proxyModifyRequest(ou *url.URL) func(req *http.Request) { return func(r *http.Request) { claims, _ := a.getClaims(r) - if claims.Proxy.BackendOverride != "" { + if claims.Proxy != nil && claims.Proxy.BackendOverride != "" { u, err := url.Parse(claims.Proxy.BackendOverride) if err != nil { a.log.WithField("backend_override", claims.Proxy.BackendOverride).WithError(err).Warning("failed parse user backend override")