Skip to content

Commit 4edbd8c

Browse files
drdukerclaude
andcommitted
Fix lint errors and restore token auth redirect logic
- Fix golangci-lint wsl errors in gcp_test.go by adding blank lines before assignments that were cuddled with non-assignments - Restore accidentally removed redirect logic in AuthChooser that automatically redirects to the token page when a cluster requires token authentication without OIDC configured 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 83732cd commit 4edbd8c

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

backend/pkg/auth/gcp_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ func TestHandleGCPAuthCallback_StateMismatch(t *testing.T) {
288288
Name: "gcp_oauth_cluster",
289289
Value: "test-cluster",
290290
})
291+
291292
rr := httptest.NewRecorder()
292293

293294
handler(rr, req)
@@ -309,6 +310,7 @@ func TestHandleGCPAuthCallback_MissingClusterCookie(t *testing.T) {
309310
Name: "gcp_oauth_state",
310311
Value: "test-state",
311312
})
313+
312314
rr := httptest.NewRecorder()
313315

314316
handler(rr, req)
@@ -334,6 +336,7 @@ func TestHandleGCPAuthCallback_InvalidClusterInCookie(t *testing.T) {
334336
Name: "gcp_oauth_cluster",
335337
Value: "-invalid-cluster",
336338
})
339+
337340
rr := httptest.NewRecorder()
338341

339342
handler(rr, req)

frontend/src/components/authchooser/index.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,23 @@ function AuthChooser({ children }: AuthChooserProps) {
159159
// just redirect.
160160
if (cluster.useToken === false) {
161161
history.replace(from);
162+
} else if (!clusterAuthType) {
163+
// we know that it requires token and also doesn't have oidc configured
164+
// so let's redirect to token page
165+
history.replace({
166+
pathname: generatePath(getClusterPrefixedPath('token'), {
167+
cluster: clusterName as string,
168+
}),
169+
});
162170
}
163171
}
164172
});
173+
} else if (cluster.useToken) {
174+
history.replace({
175+
pathname: generatePath(getClusterPrefixedPath('token'), {
176+
cluster: clusterName as string,
177+
}),
178+
});
165179
}
166180
},
167181
// eslint-disable-next-line

0 commit comments

Comments
 (0)