pub enum Credentials {
Password {
user: String,
hash: Stored,
},
Token,
}Expand description
What a sign-in is checked against.
Variants§
Password
ECLIPSE_WEB_USER and ECLIPSE_WEB_PASSWORD_HASH are both set.
Token
No hash: the dashboard’s shared token is still the only human door. This is the migration
case — every install that predates the password form — and it must keep signing in until
somebody runs eclipse web passwd.
Implementations§
Source§impl Credentials
impl Credentials
Sourcepub fn resolve(lookup: impl Fn(&str) -> Option<String>) -> Result<Self, String>
pub fn resolve(lookup: impl Fn(&str) -> Option<String>) -> Result<Self, String>
Decide from the environment. lookup is asked for each name, so the caller decides where
values come from (process environment first, then .env — the same order the config loader
uses).
A hash that does not parse is an error, not a fallback: a dashboard that quietly
downgraded to the token because one line of .env had a typo would be a security decision
taken by accident.
Sourcepub fn check(&self, user: &str, secret: &str, token: &str) -> bool
pub fn check(&self, user: &str, secret: &str, token: &str) -> bool
Does this pair sign in?
Both halves are computed before either is looked at, so an unknown username costs a PBKDF2
derivation exactly like a wrong password does — otherwise the fastest way to learn a valid
username would be a stopwatch. token is the dashboard’s shared secret, used only in
Credentials::Token.
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§impl Debug for Credentials
impl Debug for Credentials
impl Eq for Credentials
Source§impl PartialEq for Credentials
impl PartialEq for Credentials
impl StructuralPartialEq for Credentials
Auto Trait Implementations§
impl Forget for Credentials
impl Freeze for Credentials
impl Move for Credentials
impl RefUnwindSafe for Credentials
impl Send for Credentialswhere
RawVecInner: Send,
impl Sync for Credentialswhere
RawVecInner: Sync,
impl Unpin for Credentials
impl UnsafeUnpin for Credentials
impl UnwindSafe for Credentialswhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.