Add development credentials provider (#11505)
This PR adds a new development credentials provider for the purpose of streamlining local development against production collab. ## Problem Today if you want to run a development build of Zed against the production collab server, you need to either: 1. Enter your keychain password every time in order to retrieve your saved credentials 2. Re-authenticate with zed.dev every time - This can get annoying as you need to pop out into a browser window - I've also seen cases where if you re-auth too many times in a row GitHub will make you confirm the authentication, as it looks suspicious ## Solution This PR decouples the concept of the credentials provider from the keychain, and adds a new development credentials provider to address this specific case. Now when running a development build of Zed and the `ZED_DEVELOPMENT_AUTH` environment variable is set to a non-empty value, the credentials will be saved to disk instead of the system keychain. While this is not as secure as storing them in the system keychain, since it is only used for development the tradeoff seems acceptable for the resulting improvement in UX. Release Notes: - N/A
This commit is contained in:
parent
c260f7d5ac
commit
d64106e01b
3 changed files with 203 additions and 57 deletions
|
@ -542,10 +542,12 @@ fn handle_open_request(
|
|||
|
||||
async fn authenticate(client: Arc<Client>, cx: &AsyncAppContext) -> Result<()> {
|
||||
if stdout_is_a_pty() {
|
||||
if client::IMPERSONATE_LOGIN.is_some() {
|
||||
if *client::ZED_DEVELOPMENT_AUTH {
|
||||
client.authenticate_and_connect(true, &cx).await?;
|
||||
} else if client::IMPERSONATE_LOGIN.is_some() {
|
||||
client.authenticate_and_connect(false, &cx).await?;
|
||||
}
|
||||
} else if client.has_keychain_credentials(&cx).await {
|
||||
} else if client.has_credentials(&cx).await {
|
||||
client.authenticate_and_connect(true, &cx).await?;
|
||||
}
|
||||
Ok::<_, anyhow::Error>(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue