fix(#411): auth & frontend remediation — all 6 phases complete #418

Merged
jason.woltje merged 51 commits from fix/auth-frontend-remediation into develop 2026-02-16 23:11:42 +00:00
2 changed files with 0 additions and 63 deletions
Showing only changes of commit 1d7d5a9d01 - Show all commits

View File

@@ -1,45 +0,0 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { LoginButton } from "./LoginButton";
const { mockOAuth2 } = vi.hoisted(() => ({
mockOAuth2: vi.fn(),
}));
vi.mock("@/lib/auth-client", () => ({
signIn: {
oauth2: mockOAuth2,
},
}));
describe("LoginButton", (): void => {
beforeEach((): void => {
mockOAuth2.mockClear();
});
it("should render sign in button", (): void => {
render(<LoginButton />);
const button = screen.getByRole("button", { name: /sign in/i });
expect(button).toBeInTheDocument();
});
it("should initiate OAuth2 sign-in on click", async (): Promise<void> => {
const user = userEvent.setup();
render(<LoginButton />);
const button = screen.getByRole("button", { name: /sign in/i });
await user.click(button);
expect(mockOAuth2).toHaveBeenCalledWith({
providerId: "authentik",
callbackURL: "/",
});
});
it("should have proper styling", (): void => {
render(<LoginButton />);
const button = screen.getByRole("button", { name: /sign in/i });
expect(button).toHaveClass("w-full");
});
});

View File

@@ -1,18 +0,0 @@
"use client";
import { Button } from "@mosaic/ui";
import { signIn } from "@/lib/auth-client";
export function LoginButton(): React.JSX.Element {
const handleLogin = (): void => {
// Use BetterAuth's genericOAuth client to initiate the OIDC flow.
// This POSTs to /auth/sign-in/oauth2 and follows the returned redirect URL.
void signIn.oauth2({ providerId: "authentik", callbackURL: "/" });
};
return (
<Button variant="primary" onClick={handleLogin} className="w-full">
Sign In with Authentik
</Button>
);
}