mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-25 12:47:14 +00:00
* Improve GHES flow It's clear to me now that a lot of users of the GHES flow have auth behind a VPN. Something that we cannot support in the OAuth flow because we require making a request to vscode.dev who makes a request to the GHES instance. In light of this, we will remove the OAuth flow for GHES. Fear not, though... because both the Device Code Flow and the PAT flow are there and the PAT flow has been improved in 1.75... so in conclusion, I think GHES is handled as best we can with this PR. Additionally, there is some "Hosted GitHub Enterprise" scenarios popping up, and this future proofs that by allowing "Hosted GitHub Enterprise" experiences to go through the OAuth flow because we know for a fact that they will be accessible from vscode.dev. Fixes #169619 Fixes https://github.com/microsoft/vscode-internalbacklog/issues/3398 * Use api. sub domain and update telemetry logic
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
import { Uri } from 'vscode';
|
|
import { AuthProviderType } from '../github';
|
|
|
|
const VALID_DESKTOP_CALLBACK_SCHEMES = [
|
|
'vscode',
|
|
'vscode-insiders',
|
|
// On Windows, some browsers don't seem to redirect back to OSS properly.
|
|
// As a result, you get stuck in the auth flow. We exclude this from the
|
|
// list until we can figure out a way to fix this behavior in browsers.
|
|
// 'code-oss',
|
|
'vscode-wsl',
|
|
'vscode-exploration'
|
|
];
|
|
|
|
export function isSupportedClient(uri: Uri): boolean {
|
|
return (
|
|
VALID_DESKTOP_CALLBACK_SCHEMES.includes(uri.scheme) ||
|
|
// vscode.dev & insiders.vscode.dev
|
|
/(?:^|\.)vscode\.dev$/.test(uri.authority) ||
|
|
// github.dev & codespaces
|
|
/(?:^|\.)github\.dev$/.test(uri.authority)
|
|
);
|
|
}
|
|
|
|
export function isSupportedTarget(type: AuthProviderType, gheUri?: Uri): boolean {
|
|
return (
|
|
type === AuthProviderType.github ||
|
|
/\.ghe\.com$/.test(gheUri!.authority)
|
|
);
|
|
}
|