Struct splinter::rest_api::auth::authorization::allow_keys::AllowKeysAuthorizationHandler
source · [−]pub struct AllowKeysAuthorizationHandler { /* private fields */ }Expand description
A file-backed authorization handler that permits admin keys
The authorization handler only accepts Identity::Key identities; if a different type of
identity is provided, the handler will return AuthorizationHandlerResult::Continue. If a key
is provided, the handler will check if the key is present in the backing file. If the key is in
the backing file, the handler will return AuthorizationHandlerResult::Allow; if not, it will
return AuthorizationHandlerResult::Continue. The permission_id argument for
AuthorizationHandler::has_permission is ignored because this authorization handler provides
admin privileges (all permissions).
The authorization handler’s backing file must be a list of keys separated by newlines.
The list of keys in the file are cached in-memory by the authorization handler; this means that
the handler will not have to read from the file every time permissions are checked. Instead,
each time the handler checks for permissions, it will check the backing file for any changes
since the last read, refreshing the internal cache if necessary. If the backing file does not
exist, is removed, or becomes unavailable, the authorization handler will treat the list of keys
as empty (all permission checks will receive a AuthorizationHandlerResult::Continue result).
Implementations
Trait Implementations
sourceimpl AuthorizationHandler for AllowKeysAuthorizationHandler
impl AuthorizationHandler for AllowKeysAuthorizationHandler
sourcefn has_permission(
&self,
identity: &Identity,
_permission_id: &str
) -> Result<AuthorizationHandlerResult, InternalError>
fn has_permission(
&self,
identity: &Identity,
_permission_id: &str
) -> Result<AuthorizationHandlerResult, InternalError>
Determines if the given identity has the requested permission
sourcefn clone_box(&self) -> Box<dyn AuthorizationHandler>
fn clone_box(&self) -> Box<dyn AuthorizationHandler>
Clone implementation for AuthorizationHandler. The implementation of the Clone trait for
Box<dyn AuthorizationHandler> calls this method. Read more
sourceimpl Clone for AllowKeysAuthorizationHandler
impl Clone for AllowKeysAuthorizationHandler
sourcefn clone(&self) -> AllowKeysAuthorizationHandler
fn clone(&self) -> AllowKeysAuthorizationHandler
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl RefUnwindSafe for AllowKeysAuthorizationHandler
impl Send for AllowKeysAuthorizationHandler
impl Sync for AllowKeysAuthorizationHandler
impl Unpin for AllowKeysAuthorizationHandler
impl UnwindSafe for AllowKeysAuthorizationHandler
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<P, N> IntoBytes<P> for N where
P: Message + FromNative<N>,
impl<P, N> IntoBytes<P> for N where
P: Message + FromNative<N>,
fn into_bytes(self) -> Result<Vec<u8, Global>, ProtoConversionError>
sourceimpl<N, P> IntoNative<N> for P where
N: FromProto<P>,
impl<N, P> IntoNative<N> for P where
N: FromProto<P>,
fn into_native(self) -> Result<N, ProtoConversionError>
sourceimpl<N, P> IntoProto<P> for N where
P: FromNative<N>,
impl<N, P> IntoProto<P> for N where
P: FromNative<N>,
fn into_proto(self) -> Result<P, ProtoConversionError>
sourceimpl<T> IntoSql for T
impl<T> IntoSql for T
sourcefn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
Convert self to an expression for Diesel’s query builder. Read more
sourcefn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
Convert &self to an expression for Diesel’s query builder. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more