mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
fixes for oauth spec - adds github oauth support. Resource paramater. (#6281)
This commit is contained in:
@@ -28,8 +28,8 @@ describe('OAuthUtils', () => {
|
||||
});
|
||||
|
||||
describe('buildWellKnownUrls', () => {
|
||||
it('should build correct well-known URLs', () => {
|
||||
const urls = OAuthUtils.buildWellKnownUrls('https://example.com/path');
|
||||
it('should build standard root-based URLs by default', () => {
|
||||
const urls = OAuthUtils.buildWellKnownUrls('https://example.com/mcp');
|
||||
expect(urls.protectedResource).toBe(
|
||||
'https://example.com/.well-known/oauth-protected-resource',
|
||||
);
|
||||
@@ -37,6 +37,42 @@ describe('OAuthUtils', () => {
|
||||
'https://example.com/.well-known/oauth-authorization-server',
|
||||
);
|
||||
});
|
||||
|
||||
it('should build path-based URLs when includePathSuffix is true', () => {
|
||||
const urls = OAuthUtils.buildWellKnownUrls(
|
||||
'https://example.com/mcp',
|
||||
true,
|
||||
);
|
||||
expect(urls.protectedResource).toBe(
|
||||
'https://example.com/.well-known/oauth-protected-resource/mcp',
|
||||
);
|
||||
expect(urls.authorizationServer).toBe(
|
||||
'https://example.com/.well-known/oauth-authorization-server/mcp',
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle root path correctly', () => {
|
||||
const urls = OAuthUtils.buildWellKnownUrls('https://example.com', true);
|
||||
expect(urls.protectedResource).toBe(
|
||||
'https://example.com/.well-known/oauth-protected-resource',
|
||||
);
|
||||
expect(urls.authorizationServer).toBe(
|
||||
'https://example.com/.well-known/oauth-authorization-server',
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle trailing slash in path', () => {
|
||||
const urls = OAuthUtils.buildWellKnownUrls(
|
||||
'https://example.com/mcp/',
|
||||
true,
|
||||
);
|
||||
expect(urls.protectedResource).toBe(
|
||||
'https://example.com/.well-known/oauth-protected-resource/mcp',
|
||||
);
|
||||
expect(urls.authorizationServer).toBe(
|
||||
'https://example.com/.well-known/oauth-authorization-server/mcp',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('fetchProtectedResourceMetadata', () => {
|
||||
|
||||
Reference in New Issue
Block a user