AuthSessionManager

Struct AuthSessionManager 

Source
pub struct AuthSessionManager {
    sessions: Arc<Mutex<HashMap<String, Session>>>,
    process_refs: Arc<Mutex<ProcessRefs>>,
}

Fields§

§sessions: Arc<Mutex<HashMap<String, Session>>>§process_refs: Arc<Mutex<ProcessRefs>>

Implementations§

Source§

impl AuthSessionManager

Source

pub fn new() -> Self

Source

pub fn start_session( &self, provider_id: String, into_bundle_id: Option<String>, ) -> StartSessionResult

Allocate a new session id and store the initial Pending state. The caller (handler) is responsible for spawning the CLI and feeding stdout lines into record_line.

Source

pub fn record_line( &self, session_id: &str, line: &str, ) -> Option<AuthPatternMatch>

Feed a single line of CLI stdout/stderr into the session. Returns the pattern match (if any) so the handler can decide to forward the URL elsewhere (e.g. broker event).

Source

pub fn finish_success(&self, session_id: &str, bundle_id: String) -> bool

Handler-side completion hook. Called when the CLI exits or auth check confirms success. Transitions the session to a terminal state.

Source

pub fn finish_failure(&self, session_id: &str, error: String) -> bool

Source

pub fn poll_session(&self, session_id: &str) -> Option<PollSessionResult>

Poll a session’s current status. Also sweeps timed-out sessions: if the session has been Pending past SESSION_TIMEOUT_SECS, transition to Failed and return that.

Source

pub fn cancel_session(&self, session_id: &str) -> bool

Cancel a session: transition state to Failed + abort the spawned drain task (which kills the child via kill_on_drop). Returns true if the state transition happened (false on unknown / already-terminal session — the process refs are torn down either way so a re-fired cancel is a no-op).

Source

pub fn attach_pty_pid(&self, session_id: &str, pid: u32)

Register the PID of a PTY-backed auth subprocess so cancel_session can terminate it. Called by auth.start after spawning a PTY login (in addition to attach_process).

Source

pub fn attach_process( &self, session_id: &str, drain_task: JoinHandle<()>, stdin_sender: Sender<String>, )

Register the drain task + stdin sender for a session. Called by the handler immediately after spawning the CLI.

Source

pub async fn send_to_stdin(&self, session_id: &str, line: String) -> bool

Forward a pasted callback URL to the spawned CLI’s stdin. Returns true if the session has an attached stdin sender; false if the session never spawned a CLI or the sender’s receiver was dropped.

Source

pub fn detach_process(&self, session_id: &str)

Drop a session’s process refs without aborting them. Called by the drain task itself when it exits normally so terminal state lookups still work but the resources are reclaimed.

Source

pub fn remove(&self, session_id: &str)

Remove a session from the map. Caller should only invoke this after the session is terminal AND the frontend has had time to read the final state (typically after the next successful poll). For PR A we just leave terminal sessions in the map; PR B can add an LRU sweep.

Source

pub fn transcript(&self, session_id: &str) -> Option<Vec<String>>

Read the full transcript of captured stdout/stderr lines. Used by integration tests; exposed for completeness even though no production caller currently reads it.

Trait Implementations§

Source§

impl Default for AuthSessionManager

Source§

fn default() -> AuthSessionManager

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,