-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LibGit2 credential approval/rejection #23711
Conversation
I missed a usage of |
219a750
to
cc25af0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from properly deprecating get_creds!
this seems reasonable.
@@ -45,7 +45,7 @@ function user_abort() | |||
(Cint, Cstring), | |||
Cint(Error.Callback), "Aborting, user cancelled credential request.") | |||
|
|||
return Cint(Error.EAUTH) | |||
return Cint(Error.EUSER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just going to mention that EUSER
is a generic error code which is suppose to be for callback usage. It doesn't formally mean the user cancelled the callback.
@@ -1119,14 +1119,29 @@ struct CachedCredentials <: AbstractCredentials | |||
CachedCredentials() = new(Dict{String,AbstractCredentials}()) | |||
end | |||
|
|||
"Obtain the cached credentials for the given host+protocol (credid), or return and store the default if not found" | |||
get_creds!(collection::CachedCredentials, credid, default) = get!(collection.cred, credid, default) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably deprecate get_creds!
properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a proper deprecation for this. It required adding Base.get!(cache::CachedCredentials, cred_id, default)
. Additionally, I switched the test/misc.jl tests to use get!
.
cc25af0
to
93c3dbb
Compare
Differentiates this error from EAUTH exceptions which indicate that the credentials are invalid.
Only save credentials to the cache when they are used successfully. Credentials that trigger an EAUTH exception will be removed from the cache. Note: Modifications to the credential field in the CredentialPayload should not modify cached credentials until they are approved.
Since the credential ID is based upon the URL which couldn't change during the lifetime of a CredentialPayload then we only need to pull a credential out of the cache once.
93c3dbb
to
86c6a17
Compare
Previously the credential callback would mutate the explicitly provided credential or cached credential. With this change we never mutate explicitly provided credentials and only add/replace credentials in the cache when they have successfully been used.
Additionally, this PR lays the ground work for integrating other credential storage systems such as the git credential helpers and removes the LibGit2 function
get_creds!
.Part of #20725.