1
0
forked from baron/baron-sso

af 린트 적용

This commit is contained in:
2026-02-24 11:02:30 +09:00
parent c4d3a9f7a1
commit 6a7676f95c
6 changed files with 39 additions and 22 deletions

View File

@@ -231,10 +231,7 @@ export function TenantUserGroupsTab() {
t("msg.admin.groups.list.delete_success", "그룹이 삭제되었습니다."), t("msg.admin.groups.list.delete_success", "그룹이 삭제되었습니다."),
); );
groupsQuery.refetch(); groupsQuery.refetch();
if ( if (selectedGroupId && selectedGroupId === deleteMutation.variables) {
selectedGroupId &&
selectedGroupId === deleteMutation.variables
) {
setSelectedGroupId(null); setSelectedGroupId(null);
} }
}, },

View File

@@ -96,7 +96,8 @@ export function UserGroupDetailPage() {
}); });
const addMemberMutation = useMutation({ const addMemberMutation = useMutation({
mutationFn: (userId: string) => addGroupMember(tenantId ?? "", id ?? "", userId), mutationFn: (userId: string) =>
addGroupMember(tenantId ?? "", id ?? "", userId),
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["user-group-detail", id] }); queryClient.invalidateQueries({ queryKey: ["user-group-detail", id] });
setIsAddMemberOpen(false); setIsAddMemberOpen(false);
@@ -115,7 +116,8 @@ export function UserGroupDetailPage() {
}); });
const removeMemberMutation = useMutation({ const removeMemberMutation = useMutation({
mutationFn: (userId: string) => removeGroupMember(tenantId ?? "", id ?? "", userId), mutationFn: (userId: string) =>
removeGroupMember(tenantId ?? "", id ?? "", userId),
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["user-group-detail", id] }); queryClient.invalidateQueries({ queryKey: ["user-group-detail", id] });
toast.success( toast.success(
@@ -129,7 +131,12 @@ export function UserGroupDetailPage() {
const assignRoleMutation = useMutation({ const assignRoleMutation = useMutation({
mutationFn: () => mutationFn: () =>
assignGroupRole(tenantId ?? "", id ?? "", selectedTargetTenantId, selectedRelation), assignGroupRole(
tenantId ?? "",
id ?? "",
selectedTargetTenantId,
selectedRelation,
),
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["user-group-roles", id] }); queryClient.invalidateQueries({ queryKey: ["user-group-roles", id] });
setIsAddRoleOpen(false); setIsAddRoleOpen(false);
@@ -148,7 +155,12 @@ export function UserGroupDetailPage() {
const removeRoleMutation = useMutation({ const removeRoleMutation = useMutation({
mutationFn: (role: { targetTenantId: string; relation: string }) => mutationFn: (role: { targetTenantId: string; relation: string }) =>
removeGroupRole(tenantId ?? "", id ?? "", role.targetTenantId, role.relation), removeGroupRole(
tenantId ?? "",
id ?? "",
role.targetTenantId,
role.relation,
),
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["user-group-roles", id] }); queryClient.invalidateQueries({ queryKey: ["user-group-roles", id] });
toast.success( toast.success(

View File

@@ -2,7 +2,8 @@ import { UserManager, WebStorageStateStore } from "oidc-client-ts";
import type { AuthProviderProps } from "react-oidc-context"; import type { AuthProviderProps } from "react-oidc-context";
export const oidcConfig: AuthProviderProps = { export const oidcConfig: AuthProviderProps = {
authority: import.meta.env.VITE_OIDC_AUTHORITY || "http://localhost:5000/oidc", // Gateway Proxy URL authority:
import.meta.env.VITE_OIDC_AUTHORITY || "http://localhost:5000/oidc", // Gateway Proxy URL
client_id: import.meta.env.VITE_OIDC_CLIENT_ID || "adminfront", client_id: import.meta.env.VITE_OIDC_CLIENT_ID || "adminfront",
redirect_uri: `${window.location.origin}/auth/callback`, redirect_uri: `${window.location.origin}/auth/callback`,
response_type: "code", response_type: "code",

View File

@@ -11,7 +11,9 @@ test.describe("Auth Flow", () => {
// Verify login page content // Verify login page content
await expect(page.getByText("Baron SSO")).toBeVisible(); await expect(page.getByText("Baron SSO")).toBeVisible();
await expect(page.getByText("관리자 로그인")).toBeVisible(); await expect(page.getByText("관리자 로그인")).toBeVisible();
await expect(page.getByRole("button", { name: "SSO 계정으로 로그인" })).toBeVisible(); await expect(
page.getByRole("button", { name: "SSO 계정으로 로그인" }),
).toBeVisible();
}); });
test("authenticated user can access dashboard", async ({ page }) => { test("authenticated user can access dashboard", async ({ page }) => {

View File

@@ -82,7 +82,9 @@ test("tenant create and delete flow", async ({ page }) => {
await page.goto("/tenants"); await page.goto("/tenants");
await expect(page).toHaveURL(/\/tenants$/); await expect(page).toHaveURL(/\/tenants$/);
await expect(page.getByRole("heading", { name: "테넌트 목록" })).toBeVisible(); await expect(
page.getByRole("heading", { name: "테넌트 목록" }),
).toBeVisible();
// Create // Create
const addTenantLink = page.getByRole("link", { name: "테넌트 추가" }); const addTenantLink = page.getByRole("link", { name: "테넌트 추가" });
@@ -94,7 +96,9 @@ test("tenant create and delete flow", async ({ page }) => {
await page.getByLabel("테넌트 유형").selectOption("COMPANY"); await page.getByLabel("테넌트 유형").selectOption("COMPANY");
await page.getByLabel("슬러그 (Slug)").fill("test-tenant"); await page.getByLabel("슬러그 (Slug)").fill("test-tenant");
await page.getByLabel("설명").fill("This is an E2E test tenant"); await page.getByLabel("설명").fill("This is an E2E test tenant");
await page.getByLabel("허용된 도메인 (콤마로 구분)").fill("test.com, example.com"); await page
.getByLabel("허용된 도메인 (콤마로 구분)")
.fill("test.com, example.com");
await page.getByRole("button", { name: "생성" }).click(); await page.getByRole("button", { name: "생성" }).click();
await expect(page).toHaveURL(/\/tenants$/); await expect(page).toHaveURL(/\/tenants$/);
@@ -107,7 +111,9 @@ test("tenant create and delete flow", async ({ page }) => {
page.once("dialog", (dialog) => dialog.accept()); page.once("dialog", (dialog) => dialog.accept());
await createdRow.getByRole("button", { name: "삭제" }).click(); await createdRow.getByRole("button", { name: "삭제" }).click();
await expect(page.locator("tbody tr").filter({ hasText: uniqueName })).toHaveCount(0); await expect(
page.locator("tbody tr").filter({ hasText: uniqueName }),
).toHaveCount(0);
}); });
test("tenant creation form validation", async ({ page }) => { test("tenant creation form validation", async ({ page }) => {
@@ -119,4 +125,3 @@ test("tenant creation form validation", async ({ page }) => {
// Since 'name' is required, we check if button is still disabled or form doesn't navigate // Since 'name' is required, we check if button is still disabled or form doesn't navigate
await expect(page).toHaveURL(/\/tenants\/new$/); await expect(page).toHaveURL(/\/tenants\/new$/);
}); });

View File

@@ -1,5 +1,5 @@
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react"; import react from "@vitejs/plugin-react";
import { defineConfig } from "vitest/config";
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react()],