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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T