1
0
forked from baron/baron-sso

fix: resolve admin session infinite reload loop and sync auth state

- Prevent infinite redirection loop by clearing oidc-client user state on 401 errors.
- Sync apiClient request interceptor to use userManager.getUser() for reliable token retrieval.
- Add extensive console logs for better session issue diagnosis.
- Fix TS error in LoginPage by updating button variant.
- Revert 'ae03fe1' (updated playwright fixtures to real domain) as requested.
This commit is contained in:
2026-04-21 17:06:03 +09:00
parent ae03fe1475
commit 4427ab1f85
13 changed files with 119 additions and 52 deletions

View File

@@ -10,7 +10,7 @@ test.describe("Authentication", () => {
window as Window & typeof globalThis & { _IS_TEST_MODE?: boolean }
)._IS_TEST_MODE = true;
const authority = "https://sso.hmac.kr/oidc";
const authority = "http://localhost:5000/oidc";
const client_id = "adminfront";
const key = `oidc.user:${authority}:${client_id}`;
const authData = {
@@ -45,12 +45,12 @@ test.describe("Authentication", () => {
if (url.includes(".well-known/openid-configuration")) {
await route.fulfill({
json: {
issuer: "https://sso.hmac.kr/oidc",
authorization_endpoint: "https://sso.hmac.kr/oidc/auth",
token_endpoint: "https://sso.hmac.kr/oidc/token",
jwks_uri: "https://sso.hmac.kr/oidc/jwks",
userinfo_endpoint: "https://sso.hmac.kr/oidc/userinfo",
end_session_endpoint: "https://sso.hmac.kr/oidc/session/end",
issuer: "http://localhost:5000/oidc",
authorization_endpoint: "http://localhost:5000/oidc/auth",
token_endpoint: "http://localhost:5000/oidc/token",
jwks_uri: "http://localhost:5000/oidc/jwks",
userinfo_endpoint: "http://localhost:5000/oidc/userinfo",
end_session_endpoint: "http://localhost:5000/oidc/session/end",
},
headers: { "Access-Control-Allow-Origin": "*" },
});

View File

@@ -9,7 +9,7 @@ test.describe("Bulk Actions and Tree Search", () => {
window as Window & typeof globalThis & { _IS_TEST_MODE?: boolean }
)._IS_TEST_MODE = true;
const authority = "https://sso.hmac.kr/oidc";
const authority = "http://localhost:5000/oidc";
const client_id = "adminfront";
const key = `oidc.user:${authority}:${client_id}`;
const authData = {
@@ -114,7 +114,7 @@ test.describe("Bulk Actions and Tree Search", () => {
});
await page.route("**/oidc/**", async (route) => {
await route.fulfill({ json: { issuer: "https://sso.hmac.kr/oidc" } });
await route.fulfill({ json: { issuer: "http://localhost:5000/oidc" } });
});
});

View File

@@ -3,7 +3,7 @@ import { expect, test } from "@playwright/test";
test.describe("Tenant Owners Management", () => {
test.beforeEach(async ({ page }) => {
await page.addInitScript(() => {
const authority = "https://sso.hmac.kr/oidc";
const authority = "http://localhost:5000/oidc";
const client_id = "adminfront";
const key = `oidc.user:${authority}:${client_id}`;
const authData = {
@@ -26,7 +26,7 @@ test.describe("Tenant Owners Management", () => {
});
await page.route("**/oidc/**", async (route) => {
await route.fulfill({ json: { issuer: "https://sso.hmac.kr/oidc" } });
await route.fulfill({ json: { issuer: "http://localhost:5000/oidc" } });
});
await page.route(/.*\/api\/v1\/.*/, async (route) => {

View File

@@ -9,7 +9,7 @@ test.describe("Tenants Management", () => {
window as Window & typeof globalThis & { _IS_TEST_MODE?: boolean }
)._IS_TEST_MODE = true;
const authority = "https://sso.hmac.kr/oidc";
const authority = "http://localhost:5000/oidc";
const client_id = "adminfront";
const key = `oidc.user:${authority}:${client_id}`;
const authData = {
@@ -52,7 +52,7 @@ test.describe("Tenants Management", () => {
});
await page.route("**/oidc/**", async (route) => {
await route.fulfill({ json: { issuer: "https://sso.hmac.kr/oidc" } });
await route.fulfill({ json: { issuer: "http://localhost:5000/oidc" } });
});
});

View File

@@ -3,7 +3,7 @@ import { expect, test } from "@playwright/test";
test.describe("User Management", () => {
test.beforeEach(async ({ page }) => {
await page.addInitScript(() => {
const authority = "https://sso.hmac.kr/oidc";
const authority = "http://localhost:5000/oidc";
const client_id = "adminfront";
const key = `oidc.user:${authority}:${client_id}`;
const authData = {
@@ -33,15 +33,15 @@ test.describe("User Management", () => {
if (route.request().url().includes("/.well-known/openid-configuration")) {
return route.fulfill({
json: {
issuer: "https://sso.hmac.kr/oidc",
authorization_endpoint: "https://sso.hmac.kr/oidc/auth",
token_endpoint: "https://sso.hmac.kr/oidc/token",
userinfo_endpoint: "https://sso.hmac.kr/oidc/userinfo",
jwks_uri: "https://sso.hmac.kr/oidc/jwks",
issuer: "http://localhost:5000/oidc",
authorization_endpoint: "http://localhost:5000/oidc/auth",
token_endpoint: "http://localhost:5000/oidc/token",
userinfo_endpoint: "http://localhost:5000/oidc/userinfo",
jwks_uri: "http://localhost:5000/oidc/jwks",
},
});
}
await route.fulfill({ json: { issuer: "https://sso.hmac.kr/oidc" } });
await route.fulfill({ json: { issuer: "http://localhost:5000/oidc" } });
});
await page.route(/.*\/api\/v1\/.*/, async (route) => {

View File

@@ -9,7 +9,7 @@ test.describe("Users Bulk Upload", () => {
window as Window & typeof globalThis & { _IS_TEST_MODE?: boolean }
)._IS_TEST_MODE = true;
const authority = "https://sso.hmac.kr/oidc";
const authority = "http://localhost:5000/oidc";
const client_id = "adminfront";
const key = `oidc.user:${authority}:${client_id}`;
const authData = {
@@ -54,7 +54,7 @@ test.describe("Users Bulk Upload", () => {
});
await page.route("**/oidc/**", async (route) => {
await route.fulfill({ json: { issuer: "https://sso.hmac.kr/oidc" } });
await route.fulfill({ json: { issuer: "http://localhost:5000/oidc" } });
});
});

View File

@@ -3,7 +3,7 @@ import { expect, test } from "@playwright/test";
test.describe("User Schema Dynamic Form", () => {
test.beforeEach(async ({ page }) => {
await page.addInitScript(() => {
const authority = "https://sso.hmac.kr/oidc";
const authority = "http://localhost:5000/oidc";
const client_id = "adminfront";
const key = `oidc.user:${authority}:${client_id}`;
const authData = {
@@ -35,15 +35,15 @@ test.describe("User Schema Dynamic Form", () => {
if (route.request().url().includes("/.well-known/openid-configuration")) {
return route.fulfill({
json: {
issuer: "https://sso.hmac.kr/oidc",
authorization_endpoint: "https://sso.hmac.kr/oidc/auth",
token_endpoint: "https://sso.hmac.kr/oidc/token",
userinfo_endpoint: "https://sso.hmac.kr/oidc/userinfo",
jwks_uri: "https://sso.hmac.kr/oidc/jwks",
issuer: "http://localhost:5000/oidc",
authorization_endpoint: "http://localhost:5000/oidc/auth",
token_endpoint: "http://localhost:5000/oidc/token",
userinfo_endpoint: "http://localhost:5000/oidc/userinfo",
jwks_uri: "http://localhost:5000/oidc/jwks",
},
});
}
await route.fulfill({ json: { issuer: "https://sso.hmac.kr/oidc" } });
await route.fulfill({ json: { issuer: "http://localhost:5000/oidc" } });
});
await page.route(/.*\/api\/v1\/.*/, async (route) => {