Skip to content

Commit bac384f

Browse files
committed
simplify tests
1 parent 354318f commit bac384f

File tree

1 file changed

+0
-60
lines changed

1 file changed

+0
-60
lines changed

src/client/auth.test.ts

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,65 +1030,5 @@ describe("OAuth Authorization", () => {
10301030
expect(body.get("grant_type")).toBe("refresh_token");
10311031
expect(body.get("refresh_token")).toBe("refresh123");
10321032
});
1033-
1034-
it("verifies resource parameter distinguishes between different paths on same domain", async () => {
1035-
// Mock successful metadata discovery
1036-
mockFetch.mockImplementation((url) => {
1037-
const urlString = url.toString();
1038-
if (urlString.includes("/.well-known/oauth-authorization-server")) {
1039-
return Promise.resolve({
1040-
ok: true,
1041-
status: 200,
1042-
json: async () => ({
1043-
issuer: "https://auth.example.com",
1044-
authorization_endpoint: "https://auth.example.com/authorize",
1045-
token_endpoint: "https://auth.example.com/token",
1046-
response_types_supported: ["code"],
1047-
code_challenge_methods_supported: ["S256"],
1048-
}),
1049-
});
1050-
}
1051-
return Promise.resolve({ ok: false, status: 404 });
1052-
});
1053-
1054-
// Mock provider methods
1055-
(mockProvider.clientInformation as jest.Mock).mockResolvedValue({
1056-
client_id: "test-client",
1057-
client_secret: "test-secret",
1058-
});
1059-
(mockProvider.tokens as jest.Mock).mockResolvedValue(undefined);
1060-
(mockProvider.saveCodeVerifier as jest.Mock).mockResolvedValue(undefined);
1061-
(mockProvider.redirectToAuthorization as jest.Mock).mockResolvedValue(undefined);
1062-
1063-
// Test with different resource paths on same domain
1064-
// This tests the security fix that prevents token confusion between
1065-
// multiple MCP servers on the same domain
1066-
const result1 = await auth(mockProvider, {
1067-
serverUrl: "https://api.example.com/mcp-server-1/v1",
1068-
});
1069-
1070-
expect(result1).toBe("REDIRECT");
1071-
1072-
const redirectCall1 = (mockProvider.redirectToAuthorization as jest.Mock).mock.calls[0];
1073-
const authUrl1: URL = redirectCall1[0];
1074-
expect(authUrl1.searchParams.get("resource")).toBe("https://api.example.com/mcp-server-1/v1");
1075-
1076-
// Clear mock calls
1077-
(mockProvider.redirectToAuthorization as jest.Mock).mockClear();
1078-
1079-
// Test with different path on same domain
1080-
const result2 = await auth(mockProvider, {
1081-
serverUrl: "https://api.example.com/mcp-server-2/v1",
1082-
});
1083-
1084-
expect(result2).toBe("REDIRECT");
1085-
1086-
const redirectCall2 = (mockProvider.redirectToAuthorization as jest.Mock).mock.calls[0];
1087-
const authUrl2: URL = redirectCall2[0];
1088-
expect(authUrl2.searchParams.get("resource")).toBe("https://api.example.com/mcp-server-2/v1");
1089-
1090-
// Verify that the two resources are different (critical for security)
1091-
expect(authUrl1.searchParams.get("resource")).not.toBe(authUrl2.searchParams.get("resource"));
1092-
});
10931033
});
10941034
});

0 commit comments

Comments
 (0)