mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-09 19:34:34 +01:00
Add oauth section to mcp.json to allow overriding of client id (#308648)
* Add `oauth` section to mcp.json to allow overriding of client id More properties (like client secret) can come later... but this is the foundation, which is a lot of plumbing... ref https://github.com/microsoft/vscode/issues/257415 * feedback
This commit is contained in:
@@ -170,7 +170,7 @@ export class MsalAuthProvider implements AuthenticationProvider {
|
||||
|
||||
async getSessions(scopes: string[] | undefined, options: AuthenticationGetSessionOptions = {}): Promise<AuthenticationSession[]> {
|
||||
const askingForAll = scopes === undefined;
|
||||
const scopeData = new ScopeData(scopes, undefined, options?.authorizationServer);
|
||||
const scopeData = new ScopeData(scopes, undefined, options?.authorizationServer, options?.clientId);
|
||||
// Do NOT use `scopes` beyond this place in the code. Use `scopeData` instead.
|
||||
this._logger.info('[getSessions]', askingForAll ? '[all]' : `[${scopeData.scopeStr}]`, 'starting');
|
||||
|
||||
@@ -200,7 +200,7 @@ export class MsalAuthProvider implements AuthenticationProvider {
|
||||
}
|
||||
|
||||
async createSession(scopes: readonly string[], options: AuthenticationProviderSessionOptions): Promise<AuthenticationSession> {
|
||||
const scopeData = new ScopeData(scopes, undefined, options.authorizationServer);
|
||||
const scopeData = new ScopeData(scopes, undefined, options.authorizationServer, options.clientId);
|
||||
// Do NOT use `scopes` beyond this place in the code. Use `scopeData` instead.
|
||||
|
||||
this._logger.info('[createSession]', `[${scopeData.scopeStr}]`, 'starting');
|
||||
@@ -315,7 +315,7 @@ export class MsalAuthProvider implements AuthenticationProvider {
|
||||
if (!claims) {
|
||||
throw new Error('No claims found in authentication challenges');
|
||||
}
|
||||
const scopeData = new ScopeData(scopes, claims, options?.authorizationServer);
|
||||
const scopeData = new ScopeData(scopes, claims, options?.authorizationServer, options?.clientId);
|
||||
this._logger.info('[getSessionsFromChallenges]', `[${scopeData.scopeStr}]`, 'with claims:', scopeData.claims);
|
||||
|
||||
const cachedPca = await this._publicClientManager.getOrCreate(scopeData.clientId);
|
||||
@@ -338,7 +338,7 @@ export class MsalAuthProvider implements AuthenticationProvider {
|
||||
// Use scopes if available, otherwise fall back to default scopes
|
||||
const effectiveScopes = scopes.length > 0 ? scopes : ['https://graph.microsoft.com/User.Read'];
|
||||
|
||||
const scopeData = new ScopeData(effectiveScopes, claims, options.authorizationServer);
|
||||
const scopeData = new ScopeData(effectiveScopes, claims, options.authorizationServer, options.clientId);
|
||||
this._logger.info('[createSessionFromChallenges]', `[${scopeData.scopeStr}]`, 'starting with claims:', claims);
|
||||
|
||||
const cachedPca = await this._publicClientManager.getOrCreate(scopeData.clientId);
|
||||
|
||||
Reference in New Issue
Block a user