mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 13:29:44 +00:00
refactor getCallbackEnvironment to return authority by default
This commit is contained in:
parent
d777991656
commit
f1a5d40aa7
|
@ -396,19 +396,19 @@ export class AzureActiveDirectoryService {
|
|||
}
|
||||
|
||||
private getCallbackEnvironment(callbackUri: vscode.Uri): string {
|
||||
if (callbackUri.authority.endsWith('.workspaces.github.com') || callbackUri.authority.endsWith('.github.dev')) {
|
||||
return `${callbackUri.authority},`;
|
||||
if (callbackUri.scheme !== 'https' && callbackUri.scheme !== 'http') {
|
||||
return callbackUri.scheme;
|
||||
}
|
||||
|
||||
switch (callbackUri.authority) {
|
||||
case 'online.visualstudio.com':
|
||||
return 'vso,';
|
||||
return 'vso';
|
||||
case 'online-ppe.core.vsengsaas.visualstudio.com':
|
||||
return 'vsoppe,';
|
||||
return 'vsoppe';
|
||||
case 'online.dev.core.vsengsaas.visualstudio.com':
|
||||
return 'vsodev,';
|
||||
return 'vsodev';
|
||||
default:
|
||||
return `${callbackUri.scheme},`;
|
||||
return callbackUri.authority;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ export class AzureActiveDirectoryService {
|
|||
const nonce = randomBytes(16).toString('base64');
|
||||
const port = (callbackUri.authority.match(/:([0-9]*)$/) || [])[1] || (callbackUri.scheme === 'https' ? 443 : 80);
|
||||
const callbackEnvironment = this.getCallbackEnvironment(callbackUri);
|
||||
const state = `${callbackEnvironment}${port},${encodeURIComponent(nonce)},${encodeURIComponent(callbackUri.query)}`;
|
||||
const state = `${callbackEnvironment},${port},${encodeURIComponent(nonce)},${encodeURIComponent(callbackUri.query)}`;
|
||||
const signInUrl = `${loginEndpointUrl}${tenant}/oauth2/v2.0/authorize`;
|
||||
let uri = vscode.Uri.parse(signInUrl);
|
||||
const codeVerifier = toBase64UrlEncoding(randomBytes(32).toString('base64'));
|
||||
|
|
Loading…
Reference in a new issue