diff --git a/internal/outpost/proxyv2/application/application.go b/internal/outpost/proxyv2/application/application.go index 470b2a7a5..7b8cffed7 100644 --- a/internal/outpost/proxyv2/application/application.go +++ b/internal/outpost/proxyv2/application/application.go @@ -98,7 +98,7 @@ func NewApplication(p api.ProxyOutpostConfig, c *http.Client, cs *ak.CryptoStore } a.sessions = a.getStore(p, externalHost) mux.Use(web.NewLoggingHandler(muxLogger, func(l *log.Entry, r *http.Request) *log.Entry { - s, err := a.sessions.Get(r, constants.SeesionName) + s, err := a.sessions.Get(r, constants.SessionName) if err != nil { return l } @@ -199,7 +199,7 @@ func (a *Application) ServeHTTP(rw http.ResponseWriter, r *http.Request) { func (a *Application) handleSignOut(rw http.ResponseWriter, r *http.Request) { //TODO: Token revocation - s, err := a.sessions.Get(r, constants.SeesionName) + s, err := a.sessions.Get(r, constants.SessionName) if err != nil { http.Redirect(rw, r, a.endpint.EndSessionEndpoint, http.StatusFound) return diff --git a/internal/outpost/proxyv2/application/mode_forward.go b/internal/outpost/proxyv2/application/mode_forward.go index e0e481f0c..740cd428f 100644 --- a/internal/outpost/proxyv2/application/mode_forward.go +++ b/internal/outpost/proxyv2/application/mode_forward.go @@ -54,7 +54,7 @@ func (a *Application) forwardHandleTraefik(rw http.ResponseWriter, r *http.Reque return } host := "" - s, _ := a.sessions.Get(r, constants.SeesionName) + s, _ := a.sessions.Get(r, constants.SessionName) // Optional suffix, which is appended to the URL if *a.proxyConfig.Mode == api.PROXYMODE_FORWARD_SINGLE { host = web.GetHost(r) @@ -111,7 +111,7 @@ func (a *Application) forwardHandleNginx(rw http.ResponseWriter, r *http.Request return } - s, _ := a.sessions.Get(r, constants.SeesionName) + s, _ := a.sessions.Get(r, constants.SessionName) s.Values[constants.SessionRedirect] = fwd.String() err = s.Save(r, rw) if err != nil { diff --git a/internal/outpost/proxyv2/application/mode_forward_nginx_test.go b/internal/outpost/proxyv2/application/mode_forward_nginx_test.go index d8c7d0fd7..5bc83538a 100644 --- a/internal/outpost/proxyv2/application/mode_forward_nginx_test.go +++ b/internal/outpost/proxyv2/application/mode_forward_nginx_test.go @@ -41,7 +41,7 @@ func TestForwardHandleNginx_Single_Headers(t *testing.T) { assert.Equal(t, rr.Code, http.StatusUnauthorized) - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) assert.Equal(t, "http://test.goauthentik.io/app", s.Values[constants.SessionRedirect]) } @@ -55,7 +55,7 @@ func TestForwardHandleNginx_Single_URI(t *testing.T) { assert.Equal(t, rr.Code, http.StatusUnauthorized) - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) assert.Equal(t, "/app", s.Values[constants.SessionRedirect]) } @@ -67,7 +67,7 @@ func TestForwardHandleNginx_Single_Claims(t *testing.T) { rr := httptest.NewRecorder() a.forwardHandleNginx(rr, req) - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) s.Values[constants.SessionClaims] = Claims{ Sub: "foo", Proxy: &ProxyClaims{ @@ -129,6 +129,6 @@ func TestForwardHandleNginx_Domain_Header(t *testing.T) { assert.Equal(t, http.StatusUnauthorized, rr.Code) - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) assert.Equal(t, "http://test.goauthentik.io/app", s.Values[constants.SessionRedirect]) } diff --git a/internal/outpost/proxyv2/application/mode_forward_traefik_test.go b/internal/outpost/proxyv2/application/mode_forward_traefik_test.go index 9aae3a0c2..038c07f08 100644 --- a/internal/outpost/proxyv2/application/mode_forward_traefik_test.go +++ b/internal/outpost/proxyv2/application/mode_forward_traefik_test.go @@ -47,7 +47,7 @@ func TestForwardHandleTraefik_Single_Headers(t *testing.T) { loc, _ := rr.Result().Location() assert.Equal(t, loc.String(), "http://test.goauthentik.io/outpost.goauthentik.io/start") - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) assert.Equal(t, "http://test.goauthentik.io/app", s.Values[constants.SessionRedirect]) } @@ -61,7 +61,7 @@ func TestForwardHandleTraefik_Single_Claims(t *testing.T) { rr := httptest.NewRecorder() a.forwardHandleTraefik(rr, req) - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) s.Values[constants.SessionClaims] = Claims{ Sub: "foo", Proxy: &ProxyClaims{ @@ -127,6 +127,6 @@ func TestForwardHandleTraefik_Domain_Header(t *testing.T) { loc, _ := rr.Result().Location() assert.Equal(t, "http://auth.test.goauthentik.io/outpost.goauthentik.io/start", loc.String()) - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) assert.Equal(t, "http://test.goauthentik.io/app", s.Values[constants.SessionRedirect]) } diff --git a/internal/outpost/proxyv2/application/mode_proxy_test.go b/internal/outpost/proxyv2/application/mode_proxy_test.go index 79b88f535..a4951f4c2 100644 --- a/internal/outpost/proxyv2/application/mode_proxy_test.go +++ b/internal/outpost/proxyv2/application/mode_proxy_test.go @@ -34,7 +34,7 @@ func TestProxy_ModifyRequest_Claims(t *testing.T) { } rr := httptest.NewRecorder() - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) s.Values[constants.SessionClaims] = Claims{ Sub: "foo", Proxy: &ProxyClaims{ @@ -62,7 +62,7 @@ func TestProxy_ModifyRequest_Claims_Invalid(t *testing.T) { } rr := httptest.NewRecorder() - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) s.Values[constants.SessionClaims] = Claims{ Sub: "foo", Proxy: &ProxyClaims{ diff --git a/internal/outpost/proxyv2/application/oauth.go b/internal/outpost/proxyv2/application/oauth.go index 833887eb3..cf87826de 100644 --- a/internal/outpost/proxyv2/application/oauth.go +++ b/internal/outpost/proxyv2/application/oauth.go @@ -43,7 +43,7 @@ func (a *Application) checkRedirectParam(r *http.Request) (string, bool) { func (a *Application) handleRedirect(rw http.ResponseWriter, r *http.Request) { newState := base64.RawURLEncoding.EncodeToString(securecookie.GenerateRandomKey(32)) - s, err := a.sessions.Get(r, constants.SeesionName) + s, err := a.sessions.Get(r, constants.SessionName) if err != nil { s.Values[constants.SessionOAuthState] = []string{} } @@ -66,7 +66,7 @@ func (a *Application) handleRedirect(rw http.ResponseWriter, r *http.Request) { } func (a *Application) handleCallback(rw http.ResponseWriter, r *http.Request) { - s, err := a.sessions.Get(r, constants.SeesionName) + s, err := a.sessions.Get(r, constants.SessionName) if err != nil { a.log.WithError(err).Trace("failed to get session") } diff --git a/internal/outpost/proxyv2/application/utils.go b/internal/outpost/proxyv2/application/utils.go index 0585068a4..0ddda63cf 100644 --- a/internal/outpost/proxyv2/application/utils.go +++ b/internal/outpost/proxyv2/application/utils.go @@ -22,7 +22,7 @@ func urlJoin(originalUrl string, newPath string) string { } func (a *Application) redirectToStart(rw http.ResponseWriter, r *http.Request) { - s, err := a.sessions.Get(r, constants.SeesionName) + s, err := a.sessions.Get(r, constants.SessionName) if err != nil { a.log.WithError(err).Warning("failed to decode session") } @@ -52,7 +52,7 @@ func (a *Application) redirectToStart(rw http.ResponseWriter, r *http.Request) { // getClaims Get claims which are currently in session // Returns an error if the session can't be loaded or the claims can't be parsed/type-cast func (a *Application) getClaims(r *http.Request) (*Claims, error) { - s, err := a.sessions.Get(r, constants.SeesionName) + s, err := a.sessions.Get(r, constants.SessionName) if err != nil { // err == user has no session/session is not valid, reject return nil, fmt.Errorf("invalid session") diff --git a/internal/outpost/proxyv2/application/utils_test.go b/internal/outpost/proxyv2/application/utils_test.go index 1cc6c3a9b..d1ac8957b 100644 --- a/internal/outpost/proxyv2/application/utils_test.go +++ b/internal/outpost/proxyv2/application/utils_test.go @@ -23,7 +23,7 @@ func TestRedirectToStart_Proxy(t *testing.T) { loc, _ := rr.Result().Location() assert.Equal(t, "https://test.goauthentik.io/outpost.goauthentik.io/start?rd=https%3A%2F%2Ftest.goauthentik.io%2Ffoo%2Fbar%2Fbaz", loc.String()) - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) assert.Equal(t, "https://test.goauthentik.io/foo/bar/baz", s.Values[constants.SessionRedirect]) } @@ -40,7 +40,7 @@ func TestRedirectToStart_Forward(t *testing.T) { loc, _ := rr.Result().Location() assert.Equal(t, "https://test.goauthentik.io/outpost.goauthentik.io/start?rd=https%3A%2F%2Ftest.goauthentik.io%2Ffoo%2Fbar%2Fbaz", loc.String()) - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) assert.Equal(t, "https://test.goauthentik.io/foo/bar/baz", s.Values[constants.SessionRedirect]) } @@ -58,7 +58,7 @@ func TestRedirectToStart_Forward_Domain_Invalid(t *testing.T) { loc, _ := rr.Result().Location() assert.Equal(t, "https://test.goauthentik.io/outpost.goauthentik.io/start?rd=https%3A%2F%2Ftest.goauthentik.io", loc.String()) - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) assert.Equal(t, "https://test.goauthentik.io", s.Values[constants.SessionRedirect]) } @@ -76,6 +76,6 @@ func TestRedirectToStart_Forward_Domain(t *testing.T) { loc, _ := rr.Result().Location() assert.Equal(t, "https://test.goauthentik.io/outpost.goauthentik.io/start?rd=https%3A%2F%2Ftest.goauthentik.io", loc.String()) - s, _ := a.sessions.Get(req, constants.SeesionName) + s, _ := a.sessions.Get(req, constants.SessionName) assert.Equal(t, "https://test.goauthentik.io", s.Values[constants.SessionRedirect]) } diff --git a/internal/outpost/proxyv2/constants/constants.go b/internal/outpost/proxyv2/constants/constants.go index 3160f42bd..366f5dc5b 100644 --- a/internal/outpost/proxyv2/constants/constants.go +++ b/internal/outpost/proxyv2/constants/constants.go @@ -1,6 +1,6 @@ package constants -const SeesionName = "authentik_proxy" +const SessionName = "authentik_proxy" const SessionOAuthState = "oauth_state" const SessionClaims = "claims"