pub struct AclPlugin {
allowed_by: Vec<String>,
denied_by: Vec<String>,
rejected_code: u16,
rejected_msg: Option<String>,
}Expand description
Admits or blocks requests based on the attached consumer’s group.
Evaluation: with no consumer attached the request is rejected 401. The
denied_by list is checked first (deny wins) — a consumer whose group is
listed is rejected. Then, when allowed_by is non-empty, a consumer whose
group is not listed (including a consumer with no group) is rejected. List
rejections use rejected_code (default 403) and carry error code
ACL_DENIED.
Fields§
§allowed_by: Vec<String>Groups permitted through; when non-empty, all other groups are rejected.
denied_by: Vec<String>Groups blocked; a match rejects regardless of allowed_by.
rejected_code: u16HTTP status used for list rejections.
rejected_msg: Option<String>Optional custom rejection message.
Implementations§
Source§impl AclPlugin
impl AclPlugin
Sourcepub fn from_config(config: &HashMap<String, Value>) -> Result<Self, String>
pub fn from_config(config: &HashMap<String, Value>) -> Result<Self, String>
Builds the plugin from node config, failing fast when neither list is set.
Accepted keys:
allowed_by(array of strings): consumer groups permitted through. When non-empty, a consumer whose group is not listed is rejected.denied_by(array of strings): consumer groups blocked. Checked beforeallowed_by— deny wins.- At least one of
allowed_by/denied_byis required. rejected_code(integer, default403): status for list rejections.rejected_msg(string, optional): custom rejection message.
type: acl
config:
allowed_by: ["partners", "internal"]
denied_by: ["banned"]
rejected_code: 403Sourcefn reject(
&self,
ctx: Context,
status: u16,
message: String,
) -> Result<PluginOutput, PluginExecutionError>
fn reject( &self, ctx: Context, status: u16, message: String, ) -> Result<PluginOutput, PluginExecutionError>
Builds a rejection carrying the context so the graph routes the error port.
Trait Implementations§
Source§impl Plugin for AclPlugin
impl Plugin for AclPlugin
Source§fn plugin_type(&self) -> &str
fn plugin_type(&self) -> &str
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: Context,
_named_inputs: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<PluginOutput, PluginExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: Context,
_named_inputs: &'life1 HashMap<String, Value>,
) -> Pin<Box<dyn Future<Output = Result<PluginOutput, PluginExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for AclPlugin
impl RefUnwindSafe for AclPlugin
impl Send for AclPlugin
impl Sync for AclPlugin
impl Unpin for AclPlugin
impl UnsafeUnpin for AclPlugin
impl UnwindSafe for AclPlugin
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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