Commit Graph

76 Commits

Author SHA1 Message Date
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
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
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
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 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
62866e4fa5 use URL class in a few places 2022-03-29 16:20:08 -07:00
Tyler Leonhardt
bee517564c remove leading / so that local dev would work 2022-03-23 16:03:26 -07:00
Tyler Leonhardt
39c6779828 depend on stable vscode.dev for auth extensions 2022-03-21 09:35:34 -07:00
Tyler James Leonhardt
18df55c4d4 Use vscode.dev for GH auth (#145424)
* Use vscode.dev for GH auth

* use correct urls and fix URLSearchParams typing
2022-03-18 15:58:44 -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
Tyler Leonhardt
c68d433ac8 copy & continue. Fixes microsoft/vscode-internalbacklog#2613 2022-01-27 16:55:27 -08:00
svennergr
22e45e9f88 Add proper error message on getUserInfo (#140277)
* Add proper error message on getUserInfo

* improved error message on getUserInfo

either display the response message or the http status text

Co-authored-by: Sven Grossmann <mail@grossmann.dev>
2022-01-10 11:35:20 -08: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
Joyce Er
b97ab80c18 Fix typo in PAT auth flow error message 2021-10-20 16:37:02 -07:00
João Moreno
a390f81744 no hack is better hack
Co-authored-by: Tyler <TylerLeonhardt@users.noreply.github.com>
2021-10-11 18:02:36 +02:00
Tyler Leonhardt
5364c56768 include insiders.vscode in nocors 2021-10-08 11:32:28 -07:00
Logan Ramos
420436d4c4 Fix #133493 2021-09-21 13:36:30 -04: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
a8134002cd lazily load experimentation service in github-authentication 2021-07-23 09:07:41 -07:00
Tyler Leonhardt
6b6be7efe1 just return if the acceptedStates don't match fixes #126084 2021-06-28 17:12:06 -07:00
Tyler Leonhardt
4a011b5297 add additional logging around github auth 2021-06-28 16:27:52 -07:00
Kai Maetzel
c200dc4909 fix isNoCorsEnvironment (#126718) 2021-06-18 17:36:59 -07:00
João Moreno
0637663fcf fix isNoCorsEnvironment 2021-05-27 11:45:12 +02:00
João Moreno
25a12c75c5 use dummy uri 2021-05-19 20:40:07 +02:00
Benjamin Pasero
159479eb5a Allow to show status bar entries with an id and name (fix #74972) 2021-05-19 14:03:37 +02:00
Kevin Abel
4978a1891e Implement GitHub Enterprise authn provider (#115940) 2021-05-07 14:13:11 -07:00
João Moreno
87a33e998d disable edu telemetry on nocors 2021-04-27 16:03:57 +02:00
João Moreno
034157dea8 gh auth: back to prod auth 2021-04-21 15:00:24 +02:00
João Moreno
d60dbbf646 gh auth: fetch json 2021-04-21 10:48:01 +02:00
João Moreno
3668a573ad gh auth: fix staging server selection 2021-04-21 10:06:26 +02:00
João Moreno
7b23ff442e more staging detection (#121769)
* more staging detection

* check for scheme
2021-04-20 13:19:06 -07:00
João Moreno
ad3e7ea1c0 gh auth: look at staging query param (#121768) 2021-04-20 13:04:56 -07:00
Rachel Macfarlane
94589129a2 Add experimentation service to github auth extension 2021-04-20 09:25:01 -07:00
João Moreno
a09d640311 github auth: improve test env detection
cc @RMacfarlane
2021-04-14 08:59:55 +02:00