pub struct SecurityPlan { /* private fields */ }Expand description
The access-control decisions taken at startup, before the socket is bound.
Split from Security itself because the Host guard has to name the port
we ACTUALLY bound, and --port 0 (the GUI’s default) only reveals that at
bind time — so the plan is made early and SecurityPlan::build finishes it.
Implementations§
Source§impl SecurityPlan
impl SecurityPlan
Sourcepub fn new(token: AccessToken, host: &str, origins: Vec<String>) -> Self
pub fn new(token: AccessToken, host: &str, origins: Vec<String>) -> Self
A plan for serving token on host, opening the API to origins.
Sourcepub fn is_loopback(&self) -> bool
pub fn is_loopback(&self) -> bool
Whether the bind host is loopback. Anything else should be refused unless the operator chose the token deliberately (SEC-9).
Sourcepub fn build(&self, port: u16) -> Result<Security, SecurityError>
pub fn build(&self, port: u16) -> Result<Security, SecurityError>
Finish the plan now that port is known.
§Errors
SecurityError::BadOrigin for an unusable --allow-origin entry.
Auto Trait Implementations§
impl Forget for SecurityPlan
impl Freeze for SecurityPlan
impl Move for SecurityPlan
impl RefUnwindSafe for SecurityPlan
impl Send for SecurityPlan
impl Sync for SecurityPlan
impl Unpin for SecurityPlan
impl UnsafeUnpin for SecurityPlanwhere
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
impl UnwindSafe for SecurityPlan
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
Mutably borrows from an owned value. Read more
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more