Commit Graph

89 Commits

Author SHA1 Message Date
Tyler James Leonhardt 2deaa78bcf Add /login/oauth path part to the ghes supported authorization server (#265703)
Fixes GHE MCP loading
2025-09-08 17:38:49 +00:00
Benjamin Pasero d44d16c464 Wire in a auth callback parameter to indicate Copilot terms were shown to the user (microsoft/vscode-internalbacklog#5761) (#262439)
* implement as a bag

* nit

---------

Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
2025-08-22 14:42:25 +09:00
Tyler James Leonhardt 2fabac413d Introduce auth-provider specific props & use it for social sign in for GitHub (#251649)
ref https://github.com/microsoft/vscode/issues/251648

NOTE: the server side is not quite ready. It doesn't redirect back to VS Code properly, but this should be good to go whenever that is.
2025-06-16 23:02:36 +02:00
Tyler James Leonhardt c235626145 issuer -> authorizationServer refactor (#250359)
* `issuer` -> `authorizationServer` refactor

Also:
* adds `authorizationServerGlobs` to the authentication contribution schema
* removes ugly MCP issuer hack and instead plumbs the authorizationServer down to the new auth providers
2025-06-02 17:38:21 -07:00
Tyler James Leonhardt 86efdcd2c1 Introduce Issuer handling in the Authentication stack (#248948)
Mostly plumbing... this enables:
```
vscode.authentication.getSession('microsoft', scopes, { issuer: "https://login.microsoftonline.com/common/v2.0" });
```
And the respective API for an auth providers to handle it being passed in.

This props up work in MCP land which needs a way to map an issuer to an auth provider... but I certainly see utility outside of that space.

Fixes https://github.com/microsoft/vscode/issues/248775#issuecomment-2876711396
2025-05-14 23:02:15 +02:00
Tyler James Leonhardt 950b401a9c Make multiple accounts the default (#231618) 2024-10-18 01:36:06 +02:00
Tyler James Leonhardt 6d482e38cd No longer look at sessions[0] (#231063)
We don't need to do this anymore now that account preference is kept across sessions.
2024-10-10 14:50:19 -07:00
Tyler James Leonhardt 52b0ec07b8 Allow Multi-account in GitHub Auth in Insiders (#229106) 2024-09-20 00:31:40 +02:00
Tyler James Leonhardt c4d1cc2e67 Fix GitHub account ids being numbers (#228045)
For a long time the account id wasn't handled correctly. It should be a string, but the API returns a number. This ensures it's a string and does some migration logic.
2024-09-10 04:39:37 +02:00
Tyler James Leonhardt 04bcb01ddf Move 'incorrect account' handling into core (#224872)
So that all auth providers can take advantage of this logic. This basically will do a light enforcement that the account you signed in to matches the account that was requested (if it was specified).

This is needed for finalization.
2024-08-05 12:45:11 -07:00
Tyler James Leonhardt 3873c58c47 If the setting value is the same, do nothing (#223518)
It seems like this event fires in Codespaces... my _guess_ is that Codespaces basically overwrites all the settings from settings sync which causes this event to fire.

It's surprising to me that this event fires even though the value hasn't changed.

I can't repro this with the test resolver, and I also cant have Codespaces use Code - OSS, so we'll just have to see how this goes.

This _should_ do the trick though.

Fixes https://github.com/microsoft/vscode/issues/223508
2024-07-24 10:11:27 -07:00
Tyler James Leonhardt ba98397575 Experimental GitHub Multi-account support (#222131)
* Have select account picker include accounts that don't match requested scopes (this will run `createSession` for that chosen account)
* Implement multi-account GitHub support behind a setting
2024-07-19 14:48:40 -07:00
Tyler James Leonhardt 1b24381b5c Adopt getAccounts API in GitHub Authentication (#221224)
This allows the GitHub Auth provider to take in a account per this proposal:

https://github.com/microsoft/vscode/blob/417dddb83f3536479f88c40e1d78edf1136a5ae5/src/vscode-dts/vscode.proposed.authGetSessions.d.ts#L35-L69

Additionally, this makes an additional small change that allows `clearSessionPreference` to work in single-account auth providers.
2024-07-09 00:19:40 +02:00
Tyler James Leonhardt 9d4274e559 Remove session if it is being replaced (#212504)
A bug that has probably existed for quite a while... if we are replacing a session, we should say the old session is removed.
2024-05-11 14:49:03 +02:00
Tyler James Leonhardt dc45ddef95 Remove requirement that there can be only one account (#212398)
This allows each set of scopes to have one account associated with it.
2024-05-09 15:59:58 -07:00
Tyler James Leonhardt cd6bd0a01a Bug fix: check account id not session id (#206990)
This should be checking the account id not the session id... otherwise the user will get a modal every time they go through the login flow.
2024-03-06 19:02:46 +01:00
Tyler James Leonhardt 191be39e5a Make sure the same GitHub account is used until we support multiple GH accounts (#206847)
Fixes https://github.com/microsoft/vscode/issues/203850
2024-03-04 15:01:51 -08:00
Tyler Leonhardt ac27273e48 Try to revoke tokens that are getting deleted
Best effort.

Fixes https://github.com/microsoft/vscode/issues/152055
2023-07-17 14:12:10 -07:00
Tyler James Leonhardt 013132a5cd Re-work auth flows into separate file (#186939)
The flows are crucial to the extension and I wanted to be able to declare which can be used when in a declarative way. This reworks the flows into that model.

Additionally, it pulls in the Client ID and secret from a config which will allow us to not rely on the vscode.dev proxy on Desktop (because we can make a distro change that includes the secret... which isn't a real secret, says GitHub)... unfortunately we still need to rely on it for Web due to CORS but we're in a position where it will be easy to rip the proxy out when GH supports it.
2023-07-03 15:06:42 -07:00
Tyler James Leonhardt f9b4b4c6a3 Pass session down so we can avoid a network call (#181570)
We don't need to fetch the user details when the Auth Session already has the info we need. This PR removes that extraneous web request.

I've also changed the `User-Agent` that we pass to be more specific so we can narrow down any future issues with spamming web requests.

Fixes #173645
2023-05-04 11:59:25 -07:00
Tyler James Leonhardt 342a1f4f52 Don't run the local server option if we are running in remote (#169076)
Additionally improve the conditional for device code flow.

ref #168338
2022-12-13 17:18:25 -08:00
Tyler James Leonhardt b9b93f2b45 Depend on platform implementations for common features (#165950)
* don't depend on externals

* remove unneeded externals
2022-11-09 14:29:21 -08:00
Logan Ramos bf1697d98c Consume proposed telemetry API (#165862)
* Consume proposed telemetry API

* Update webpack
2022-11-08 21:58:28 -05:00
Tyler James Leonhardt 9b3e147d6d GitHub Enterprise Auth improvements (#165082)
1. Namespace secrets based on the value of github-enterprise.uri to support "multiple separate GHES instances"
2. If the setting value disappears, continue using last set value. Fixes https://github.com/microsoft/vscode-pull-request-github/issues/3992
3. Mark github-enterprise.uri as requires trust
3. Refactoring like:
  * UriHandler is handled in extension.ts and passed down everywhere since we can only have 1 instance of it
  * misc style (`private` usage, better `disposable` handling)
2022-10-31 12:18:54 -07:00
Tyler James Leonhardt 6684350a58 Onboard GitHub & Microsoft auth extensions to l10n (#163662)
* onboard github-auth completely to l10n

* onboard microsoft-authentication entirely on to l10n
2022-10-14 08:41:21 -07:00
Tyler James Leonhardt fc1ef74eb0 GHES oauth flow support (#160679)
* GHES oauth flow support

* update server number

* delete testing line
2022-09-14 11:26:02 -07:00
Tyler James Leonhardt 15253f1528 add a comment for session.scopes (#151050) 2022-06-01 20:02:05 -07:00
Tyler James Leonhardt 0715386207 Return scope array that was given to us so that account icon number goes away (#151027) 2022-06-01 14:16:24 -07:00
Tyler James Leonhardt 847629239b add owner and comment to some telemetry events (#148752) 2022-05-05 17:30:51 -04:00
Tyler Leonhardt ed6d360182 add fallback auth server for github auth and better fallback logic 2022-04-15 15:48:29 -07:00
Tyler Leonhardt 46452a2dbf ensure GitHub Edu telemetry fires only per account not per session 2022-04-11 11:04:53 -07:00
Tyler Leonhardt b1fb11e18c have code-oss use device code flow 2022-03-28 09:05:28 -07:00
Johannes Rieken 4a130c40ed enable @typescript-eslint/member-delimiter-style, https://github.com/microsoft/vscode/issues/140391 2022-02-02 14:35:33 +01:00
Logan Ramos c047af40b2 Fix compilation 2022-01-19 16:18:14 -05:00
Tyler Leonhardt e8a26d3ebf ensure we treat scopes sorted and we only return a single session since GH only supports a single log in 2021-12-20 17:12:53 -05:00
Tyler James Leonhardt f67a8b753f Use device flow over PAT when we are running in a server full environment but not in a supported uri (#139255)
* initial attempt

* use github-authentication instead

* rework error handling

* update copy

* explain why Workspace
2021-12-15 22:07:49 -05:00
Tyler Leonhardt 4d496f61bc remove keytar fallback in keychain and add a ton more logging to microsoft auth. ref #133201 2021-10-25 11:16:37 -07:00
Tyler Leonhardt ab184912e6 make sure we splice the sessions if they have the same set of scopes for github authentication 2021-09-23 16:46:31 -07:00
Tyler Leonhardt 520fa49e68 refactor github auth to be a bit simpler. Remove PAT for GitHub auth since Settings Sync doesn't allow for it and add timeout so that GitHub Auth is not stuck. 2021-08-16 16:34:21 -07:00
Tyler Leonhardt a8332b75e4 delete extra afterTokenLoad 2021-08-03 16:24:28 -07:00
Tyler Leonhardt 37a8fe959c no longer call /user to verify tokens 2021-08-03 14:50:07 -07:00
Tyler Leonhardt c7e45c4fa4 Add a bunch of logging to github-authentication
Co-authored-by: Eric Amodio <eamodio@users.noreply.github.com>
2021-07-23 15:28:06 -07:00
Tyler Leonhardt c1b4cf00b9 update auth extensions to use packageJSON property instead 2021-07-23 11:48:39 -07:00
Tyler Leonhardt a8134002cd lazily load experimentation service in github-authentication 2021-07-23 09:07:41 -07:00
Tyler Leonhardt 54a2e15f6b remove unused variable 2021-07-22 17:40:13 -07:00
Tyler Leonhardt 3ed425bef9 Rework github authentication extension to make less HTTP requests.
Co-authored-by: Eric Amodio <eamodio@users.noreply.github.com>
2021-07-22 17:25:59 -07:00
VocalTrance 715798221b Fix typo in github-authentication/github.ts (#129100) 2021-07-21 06:30:45 -07:00
Tyler James Leonhardt 87d692b7bf Add scopes property to login telemetry (#128261)
* Add scopes property to login telemetry
2021-07-08 21:48:44 -07:00
Tyler Leonhardt 1d1b9961d7 sort scopes on filter for getSessions in the github auth provider. Fixes https://github.com/github/codespaces/issues/3109 2021-06-30 10:15:24 -07:00
Tyler Leonhardt 4a011b5297 add additional logging around github auth 2021-06-28 16:27:52 -07:00