feat(web): make /welcome a public path
The landing page must render without a session. Add /welcome to isPublicPath so the auth middleware lets it through (alongside /healthz and /auth/*), and assert the bypass in the public-paths test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -305,5 +305,5 @@ func (d *DexAuth) clearSessionCookie(w http.ResponseWriter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isPublicPath(p string) bool {
|
func isPublicPath(p string) bool {
|
||||||
return p == "/healthz" || strings.HasPrefix(p, "/auth/")
|
return p == "/healthz" || p == "/welcome" || strings.HasPrefix(p, "/auth/")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ func TestMiddlewarePublicPathsBypassAuth(t *testing.T) {
|
|||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
for _, path := range []string{"/healthz", "/auth/login"} {
|
for _, path := range []string{"/healthz", "/welcome", "/auth/login"} {
|
||||||
rec := httptest.NewRecorder()
|
rec := httptest.NewRecorder()
|
||||||
guarded.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, path, nil))
|
guarded.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, path, nil))
|
||||||
require.Equal(t, http.StatusOK, rec.Code, "expected %s to bypass auth", path)
|
require.Equal(t, http.StatusOK, rec.Code, "expected %s to bypass auth", path)
|
||||||
|
|||||||
Reference in New Issue
Block a user