extHostMcp.ts ×8

Frontier kind: Code frontier

unlabeled · c_c3029cde031b

20 tests · 83527 LOC · 310 files · introduces 0 tests · 60 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges60 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5892 ranges83527 lines · 310 files · Browse complete extent
All tests (intent)
20 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 60 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/api/common/extHostMcp.ts 60 introduced LOC · 8 ranges

Open complete file

996
997 constructor(
998 > public readonly authorizationServer: URI, extHostMcp.ts
999 > public readonly serverMetadata: IAuthorizationServerMetadata,
1000 > public readonly resourceMetadata: IAuthorizationProtectedResourceMetadata | undefined,
1001 > scopes: string[] | undefined,
1002 > public readonly telemetry: IAuthMetadataSource,
1003 > private readonly _log: AuthMetadataLogger,
1004 > ) {
1005 > this._scopes = scopes;
1006 > }
1007
1008 get scopes(): string[] | undefined {
1065 * @returns A new AuthMetadata instance
1066 */
1067 > export async function createAuthMetadata( extHostMcp.ts
1068 > resourceUrl: string,
1069 > initialResponseHeaders: Headers,
1070 > options: ICreateAuthMetadataOptions
1071 > ): Promise<AuthMetadata> {
1072 > const { sameOriginHeaders, fetch, log } = options;
1073 >
1074 > // Track discovery sources for telemetry
1075 > let resourceMetadataSource = IAuthResourceMetadataSource.None;
1076 > let serverMetadataSource: IAuthServerMetadataSource | undefined;
1077 >
1078 > // Parse the WWW-Authenticate header for resource_metadata and scope challenges
1079 > const { resourceMetadataChallenge, scopesChallenge: scopesChallengeFromHeader } = parseWWWAuthenticateHeaderForChallenges(initialResponseHeaders.get('WWW-Authenticate') ?? undefined, log);
1080 >
1081 > // Fetch the resource metadata either from the challenge URL or from well-known URIs
1082 > let serverMetadataUrl: string | undefined;
1083 > let resource: IAuthorizationProtectedResourceMetadata | undefined;
1084 > let scopesChallenge = scopesChallengeFromHeader;
1085 >
1086 > try {
1087 > const { metadata, discoveryUrl, errors } = await fetchResourceMetadata(resourceUrl, resourceMetadataChallenge, {
1088 > sameOriginHeaders,
1089 > fetch: (url, init) => fetch(url, init as MinimalRequestInit)
1090 > });
1091 for (const err of errors) {
1092 log(LogLevel.Warning, `Error fetching resource metadata: ${err}`);
1095
1096 // Determine if resource metadata came from header or well-known
1097 > resourceMetadataSource = resourceMetadataChallenge ? IAuthResourceMetadataSource.Header : IAuthResourceMetadataSource.WellKnown; extHostMcp.ts
1098 >
1099 > // TODO:@TylerLeonhardt support multiple authorization servers
1100 > // Consider using one that has an auth provider first, over the dynamic flow
1101 > serverMetadataUrl = metadata.authorization_servers?.[0];
1102 > if (!serverMetadataUrl) {
1103 log(LogLevel.Warning, `No authorization_servers found in resource metadata ${discoveryUrl} - Is this resource metadata configured correctly?`);
1104 } else {
1108 scopesChallenge ??= metadata.scopes_supported;
1109 resource = metadata;
1110 > } catch (e) { extHostMcp.ts
1111 log(LogLevel.Warning, `Could not fetch resource metadata: ${String(e)}`);
1112 }
1113 > extHostMcp.ts
1114 > const baseUrl = new URL(resourceUrl).origin;
1115 >
1116 > // If we are not given a resource_metadata, see if the well-known server metadata is available
1117 > // on the base url.
1118 > let additionalHeaders: Record<string, string> = {};
1119 > if (!serverMetadataUrl) {
1120 serverMetadataUrl = baseUrl;
1121 // Maintain the same origin headers when talking to the resource origin.
1124 }
1125 }
1126 > extHostMcp.ts
1127 > try {
1128 > log(LogLevel.Debug, `Fetching auth server metadata for: ${serverMetadataUrl} ...`);
1129 > const { metadata, discoveryUrl, errors } = await fetchAuthorizationServerMetadata(serverMetadataUrl, {
1130 > additionalHeaders,
1131 > fetch: (url, init) => fetch(url, init as MinimalRequestInit)
1132 > });
1133 for (const err of errors) {
1134 log(LogLevel.Warning, `Error fetching authorization server metadata: ${err}`);
1148 log
1149 );
1150 > } catch (e) { extHostMcp.ts
1151 log(LogLevel.Warning, `Error populating auth server metadata for ${serverMetadataUrl}: ${String(e)}`);
1152 }
1168 * Parses the WWW-Authenticate header for resource_metadata and scope challenges.
1169 */
1170 > function parseWWWAuthenticateHeaderForChallenges( extHostMcp.ts
1171 > wwwAuthenticateValue: string | undefined,
1172 > log: AuthMetadataLogger
1173 > ): { resourceMetadataChallenge?: string; scopesChallenge?: string[] } {
1174 > if (!wwwAuthenticateValue) {
1175 return {};
1176 }