Struct gix_credentials::helper::Cascade
source · pub struct Cascade {
pub programs: Vec<Program>,
pub stderr: bool,
pub use_http_path: bool,
pub query_user_only: bool,
}
Expand description
A list of helper programs to run in order to obtain credentials.
Fields§
§programs: Vec<Program>
The programs to run in order to obtain credentials
stderr: bool
If true, stderr is enabled when programs
are run, which is the default.
use_http_path: bool
If true, http(s) urls will take their path portion into account when obtaining credentials. Default is false. Other protocols like ssh will always use the path portion.
query_user_only: bool
If true, default false, when getting credentials, we will set a bogus password to only obtain the user name. Storage and cancellation work the same, but without a password set.
Implementations§
source§impl Cascade
impl Cascade
Initialization
sourcepub fn platform_builtin() -> Vec<Program>
pub fn platform_builtin() -> Vec<Program>
Return the programs to run for the current platform.
These are typically used as basis for all credential cascade invocations, with configured programs following afterwards.
§Note
These defaults emulate what typical git installations may use these days, as in fact it’s a configurable which comes from installation-specific configuration files which we cannot know (or guess at best). This seems like an acceptable trade-off as helpers are ignored if they fail or are not existing.
source§impl Cascade
impl Cascade
Builder
sourcepub fn extend(self, programs: impl IntoIterator<Item = Program>) -> Self
pub fn extend(self, programs: impl IntoIterator<Item = Program>) -> Self
Extend the list of programs to run programs
.
sourcepub fn use_http_path(self, toggle: bool) -> Self
pub fn use_http_path(self, toggle: bool) -> Self
If toggle
is true, http(s) urls will use the path portions of the url to obtain a credential for.
Otherwise, they will only take the user name into account.
sourcepub fn query_user_only(self, toggle: bool) -> Self
pub fn query_user_only(self, toggle: bool) -> Self
If toggle
is true, a bogus password will be provided to prevent any helper program from prompting for it, nor will
we prompt for the password. The resulting identity will have a bogus password and it’s expected to not be used by the
consuming transport.
source§impl Cascade
impl Cascade
Finalize
sourcepub fn invoke(&mut self, action: Action, prompt: Options<'_>) -> Result
pub fn invoke(&mut self, action: Action, prompt: Options<'_>) -> Result
Invoke the cascade by invoking
each program with action
, and configuring potential prompts with prompt
options.
The latter can also be used to disable the prompt entirely when setting the mode
to Disable
;=.
When getting credentials, all programs are asked until the credentials are complete, stopping the cascade. When storing or erasing all programs are instructed in order.