pub struct AllowList<'a> { /* private fields */ }Expand description
Allows only the listed Rules, over https on the default port.
Before matching, every URL must pass these rules (each refusal is a
PolicyError::Endpoint):
- scheme
https(plainhttpto a loopback host only when built withwith_loopback_http, featuretesting), default port, no user-info, no fragment; - every path segment non-empty (no
//, no trailing/), not.or..in any spelling, and free of encoded/,\, NUL or control bytes, and of characters outside RFC 3986pchar.
The query string is not constrained. Redirects are never followed by the client, so a listed endpoint cannot hand the request on.
Implementations§
Source§impl<'a> AllowList<'a>
impl<'a> AllowList<'a>
Sourcepub fn new(rules: &'a [Rule<'a>]) -> Result<Self>
pub fn new(rules: &'a [Rule<'a>]) -> Result<Self>
An allow list of rules; refuses a malformed host or template.
Sourcepub fn with_loopback_http(self) -> Self
pub fn with_loopback_http(self) -> Self
Also accept plain http to a loopback host (127.0.0.1, [::1],
localhost, any port), which then stands in for every listed host:
emulators and stub servers in tests.
Trait Implementations§
impl<'a> Copy for AllowList<'a>
Source§impl RequestPolicy for AllowList<'_>
impl RequestPolicy for AllowList<'_>
Source§fn check(&self, method: Method, url: &Url) -> Result<(), PolicyError>
fn check(&self, method: Method, url: &Url) -> Result<(), PolicyError>
Allow or refuse
method url. Called once per request, before the
token is fetched or a connection opened.Source§fn check_query(&self, sql: &str) -> Result<(), PolicyError>
fn check_query(&self, sql: &str) -> Result<(), PolicyError>
Allow or refuse the SQL text of a
BigQuery query job. The default
refuses every query: this crate has no SQL parser, so a policy that
permits queries must say which.Auto Trait Implementations§
impl<'a> Freeze for AllowList<'a>
impl<'a> RefUnwindSafe for AllowList<'a>
impl<'a> Send for AllowList<'a>
impl<'a> Sync for AllowList<'a>
impl<'a> Unpin for AllowList<'a>
impl<'a> UnsafeUnpin for AllowList<'a>
impl<'a> UnwindSafe for AllowList<'a>
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