Skip to content

Commit 88675eb

Browse files
fix: regression on tenantId in oauth2proxy frontend fix (#6100)
1 parent e0191be commit 88675eb

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

keep-ui/shared/lib/__tests__/oauth2proxy-auth.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,28 @@ describe("authorizeOAuth2Proxy", () => {
222222

223223
expect(user!.id).toBe("email@example.com");
224224
});
225+
226+
it("returns tenantId matching backend SINGLE_TENANT_UUID", () => {
227+
const headers = makeHeaders({
228+
"x-forwarded-user": "Test User",
229+
"x-forwarded-email": "test@example.com",
230+
});
231+
232+
const user = authorizeOAuth2Proxy(headers, defaultConfig);
233+
234+
expect(user).not.toBeNull();
235+
expect(user!.tenantId).toBe("keep");
236+
});
237+
238+
it("never returns undefined tenantId for a valid user", () => {
239+
const headers = makeHeaders({
240+
"x-forwarded-email": "user@example.com",
241+
});
242+
243+
const user = authorizeOAuth2Proxy(headers, defaultConfig);
244+
245+
expect(user).not.toBeNull();
246+
expect(user!.tenantId).toBeDefined();
247+
expect(user!.tenantId).not.toBe("undefined");
248+
});
225249
});

keep-ui/shared/lib/oauth2proxy-auth.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ export function authorizeOAuth2Proxy(
5151
email: emailValue || userValue || "oauth2proxy-user",
5252
accessToken: accessToken || `oauth2proxy:${identity}`,
5353
role: groups || undefined,
54+
tenantId: "keep",
5455
};
5556
}

0 commit comments

Comments
 (0)