gix_credentials::helper

Struct 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

Initialization

source

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

Builder

source

pub fn extend(self, programs: impl IntoIterator<Item = Program>) -> Self

Extend the list of programs to run programs.

source

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.

source

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

Finalize

source

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.

Trait Implementations§

source§

impl Debug for Cascade

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Cascade

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.