Commit Graph

163 Commits

Author SHA1 Message Date
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
Matt Bierner
84607a2fe2 Fix some always true/false errors in codebase (#223359)
* Fix some always true/false errors in codebase

Testing out latest TS nightly that can identify when an expression is always true/false. This caught a few likely coding mistakes in our codebase

Unsure about the intent in some of these cases but I've tried my best to understand them. Pinging relevant code owners for the confusing cases

* Bump TS version

* Fix unreachable in build scripts

* Bump versions

* restore intent

* Revert package.json change

* Fixing a few new layer checker errors

These are global in node now

* Skip lib check in integration project

* One more skiplibcheck

* More skip lib

---------

Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>
2024-07-30 15:37:27 -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:

417dddb83f/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 James Leonhardt
482d5ba393 Add some integration tests for github-auth (#195729) 2023-10-16 13:58:44 -07:00
Tyler James Leonhardt
5134662139 Remove CredentialsService & keytar (#192224)
* Remove CredentialsService & keytar

ref https://github.com/microsoft/vscode/issues/115215
fixes https://github.com/microsoft/vscode/issues/143395

* compile

* remove imports

* rip the bandaid
2023-09-05 17:47:30 -07:00
Tyler James Leonhardt
eec2fc723c Disable Local Server flow for REH (#191930)
Because spinning up ports on the remote won't always work. Instead, we have the trusty device code flow.

Fixes https://github.com/microsoft/vscode/issues/191866
Fixes https://github.com/microsoft/vscode/issues/191867
2023-08-31 22:10:26 +02: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
738ab7954c Add mode to the notification (#180977)
ref https://github.com/microsoft/vscode/issues/180803#issuecomment-1522947472
2023-04-26 23:16:39 +02:00
Tyler James Leonhardt
1714f71c41 Organize Errors in GitHub Auth and make sure no double prompting happens (#180734)
* Organize Errors in GitHub Auth and make sure no double prompting happens

This mostly just moves some strings into variables... but this also fixes the GH Auth side of https://github.com/microsoft/vscode/issues/180697 so you should only be asked once if you want to try a different way to log in.

* add comments
2023-04-24 12:59:03 -07:00
Tyler James Leonhardt
99e4904905 Add annotation to a telemetry point (#175370)
* Add annotation to a telemetry point

* forgot ,
2023-02-24 19:13:55 +01:00
Tyler James Leonhardt
57f26d2907 Fixes #173380 (#173428)
Fixes #173380
2023-02-04 15:57:24 +01:00
Tyler James Leonhardt
06eb374137 Improve GHES flow (#172959)
* Improve GHES flow

It's clear to me now that a lot of users of the GHES flow have auth behind a VPN. Something that we cannot support in the OAuth flow because we require making a request to vscode.dev who makes a request to the GHES instance.

In light of this, we will remove the OAuth flow for GHES. Fear not, though... because both the Device Code Flow and the PAT flow are there and the PAT flow has been improved in 1.75... so in conclusion, I think GHES is handled as best we can with this PR.

Additionally, there is some "Hosted GitHub Enterprise" scenarios popping up, and this future proofs that by allowing "Hosted GitHub Enterprise" experiences to go through the OAuth flow because we know for a fact that they will be accessible from vscode.dev.

Fixes #169619
Fixes https://github.com/microsoft/vscode-internalbacklog/issues/3398

* Use api. sub domain and update telemetry logic
2023-01-31 13:25:12 -08:00
Tyler James Leonhardt
656e526b3e Add EMU to session telemetry (#171186)
* Telemetry for EMU

* comment
2023-01-12 18:51:18 +01:00
Tyler James Leonhardt
a790196c19 Improve PAT auth flow (#170239)
This improves the PAT auth flow by showing a modal to open github.com with the scopes already pre-filled.

This should allow for less room for error during the PAT auth.

Additionally, this allows PAT auth flow to be used as a fallback for GH Enterprise flows.
2022-12-29 20:28:57 +01: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
0091bcae20 Fixes #164073 (#164384)
Fixes #164073
2022-10-23 17:47:27 +02: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
2457d9eb46 Plumbing for desktop to pick up strings from language packs (#163494)
Web will come in the next PR (hence the TODO)

Also this includes the smallest translation change which will be the ultimate test that this is all working.
2022-10-12 17:08:27 -07:00
Daniel Rosenwasser
5cde74b767 Fix accidental case fallthroughs in experimentation services. (#161339) 2022-09-20 12:00:32 -07:00
Sandeep Somavarapu
35c7ee9d02 Support log output channels for extensions (#161249)
* introduce log api in extension context

* separate registering output vs log channel

* Separate extension log channels in show logs command

* add logging error to embedder logger

* show extension log in the extension editor

* configure log level per extension

* change the order of log entries

* introduce logger

* align with output chanel

* revert changes

* fixes
2022-09-19 09:03:41 -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
13066d79e3 up timeout to 5min (#156846) 2022-08-01 17:15:52 -07:00
Johannes
0656d21d11 auto-fixed prefer-const violation 2022-06-08 17:49:21 +02: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
Logan Ramos
3a8b1fe03e More telemetry comments (#150303)
* Add owners to all telemetry events

* More comments

* Add comments to non typescript GDPR annotation

* Another comment
2022-05-24 16:00:55 -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
842a41c8ab add additional log statement 2022-04-27 15:38:56 -07:00
Tyler Leonhardt
a900709990 better handling of prompting and ensure PAT doesn't show up in supported products 2022-04-25 17:27:26 -07: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
5919378269 don't surface error on gets and remove microsoft secret migration. Fixes #146553 2022-04-14 12:18:33 -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
62866e4fa5 use URL class in a few places 2022-03-29 16:20:08 -07:00
Tyler Leonhardt
b1fb11e18c have code-oss use device code flow 2022-03-28 09:05:28 -07:00
Tyler Leonhardt
bee517564c remove leading / so that local dev would work 2022-03-23 16:03:26 -07:00