Skip to content

Need a way to support "challenges" #260156

@TylerLeonhardt

Description

@TylerLeonhardt

On the Microsoft side, this is on the horizon:
https://azure.microsoft.com/en-us/blog/announcing-mandatory-multi-factor-authentication-for-azure-sign-in/
https://learn.microsoft.com/en-us/entra/identity/authentication/concept-mandatory-multifactor-authentication?tabs=dotnet

Image

This is going to break us Sept 15th... because of these steps:

  • Ask for auth with scope X -> get a token
  • Use token at API -> it 401s with WWW-Authenticate saying it needs more claims
  • 🐛 we have no way to pass that down to the Microsoft auth provider, we can only have it force re-creation of a token

Implementing this in a generic fashion... we could introduce a new challenges array to getSession:

const challenges = // literally the array of WWW-Authenticate header values
vscode.authentication.getSession('microsoft', scopes, { createIfNone: true, challenges }

And then in the auth provider we could make this a concrete object that contains some well-known properties like claims, scopes, etc:

while also supporting any other key.

At this point the auth provider can do what it wants with that... which in Microsoft's case will pass the claims value into MSAL.

Alternative getSession API

Making the 2nd parameter more about influencing the shape of the token and less about the UI, we could do this:

const challenges = // literally the array of WWW-Authenticate header values
vscode.authentication.getSession('microsoft', { scopes, challenges }, { createIfNone: true }

which could then be expanded further if we want to support resource, another thing that would influence the token shape.

Metadata

Metadata

Labels

api-finalizationauthenticationIssues with the Authentication platformauthentication-microsoftIssues with the Microsoft Authentication extensionfeature-requestRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code Insiderson-release-notesIssue/pull request mentioned in release notesverifiedVerification succeeded

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions