pub struct LiveSignIn { /* private fields */ }Expand description
The sign-in policy in force, and the way back to the record that stores it.
Implementations§
Source§impl LiveSignIn
impl LiveSignIn
Sourcepub fn new(
store: Arc<dyn ConfigProvider>,
loader: Arc<dyn SignInLoader>,
) -> Self
pub fn new( store: Arc<dyn ConfigProvider>, loader: Arc<dyn SignInLoader>, ) -> Self
A policy kept in the unex record of store and built by loader; none is in force
until apply takes the record.
Sourcepub fn with_providers<I, S>(self, ids: I) -> Self
pub fn with_providers<I, S>(self, ids: I) -> Self
The IDs of the sign-in providers a policy may list; a policy listing any other is refused. Without this nothing is checked.
Sourcepub fn refresh(&self) -> Result<bool, String>
pub fn refresh(&self) -> Result<bool, String>
Takes the record stored now. It reads the store under the lock a route’s change holds, so a poll that began before a change cannot put an older record over it.
Call it where blocking is allowed.
§Errors
Why the stored record does not stand: the policy offers nothing meanwhile.
Sourcepub fn policy(&self) -> Option<Arc<dyn SignInPolicy>>
pub fn policy(&self) -> Option<Arc<dyn SignInPolicy>>
The policy in force; None when the record names none.
Sourcepub fn apply(
&self,
record: Option<&SignInPolicyProvider>,
) -> Result<bool, String>
pub fn apply( &self, record: Option<&SignInPolicyProvider>, ) -> Result<bool, String>
Puts the policy record names in force, or none when it names none, and says whether
that changed what is in force. A policy that does not build, or names a provider that is
not configured, fails closed: nothing is offered and invalid says why,
never the policy that was in force before.
§Errors
Why the policy does not stand.
Sourcepub fn offers_nothing(&self) -> bool
pub fn offers_nothing(&self) -> bool
Whether the policy in force offers no sign-in to any client from an unknown address or from loopback. A policy that offers only from other networks is not counted: no list of addresses is complete.