-
Notifications
You must be signed in to change notification settings - Fork 36.5k
Description
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
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:
- https://www.rfc-editor.org/rfc/rfc6750.html#section-3
- https://datatracker.ietf.org/doc/html/rfc9470#name-authentication-requirements
- https://datatracker.ietf.org/doc/html/rfc9728#name-use-of-www-authenticate-for
- https://datatracker.ietf.org/doc/html/rfc2617#section-3.2.1
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.