Skip to main content
Glama
clients.test.ts2.21 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import type { ClientApplication } from '@medplum/fhirtypes'; import { getClientRedirectUri } from './clients'; describe('OAuth clients', () => { test('getClientRedirectUri', () => { const client: ClientApplication = { resourceType: 'ClientApplication', id: 'test', redirectUris: ['https://example.com/callback', 'https://example.com/redirect'], }; expect(getClientRedirectUri(client, 'https://example.com/callback')).toBe('https://example.com/callback'); expect(getClientRedirectUri(client, 'https://example.com/redirect')).toBe('https://example.com/redirect'); expect(getClientRedirectUri(client, 'https://example.com/other')).toBeUndefined(); expect(getClientRedirectUri(client, 'https://malicious.com/callback')).toBeUndefined(); // Partial matching is not recommended, but supported with the allowPartial flag expect(getClientRedirectUri(client, 'https://example.com/callback?param=value', true)).toBe( 'https://example.com/callback?param=value' ); expect(getClientRedirectUri(client, 'https://example.com/callback?param=value', false)).toBeUndefined(); expect(getClientRedirectUri(client, 'https://example.com/other/path', true)).toBeUndefined(); }); test('getClientRedirectUri with deprecated redirectUri', () => { const client: ClientApplication = { resourceType: 'ClientApplication', id: 'test', redirectUri: 'https://example.com/callback', }; expect(getClientRedirectUri(client, 'https://example.com/callback')).toBe('https://example.com/callback'); expect(getClientRedirectUri(client, 'https://example.com/other')).toBeUndefined(); expect(getClientRedirectUri(client, 'https://malicious.com/callback')).toBeUndefined(); // Partial matching is not recommended, but supported with the allowPartial flag expect(getClientRedirectUri(client, 'https://example.com/callback?param=value', true)).toBe( 'https://example.com/callback?param=value' ); expect(getClientRedirectUri(client, 'https://example.com/other/path', true)).toBeUndefined(); }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/medplum/medplum'

If you have feedback or need assistance with the MCP directory API, please join our Discord server