pub trait IncomingAccessControl: Debug + Send + Sync + 'static {
fn is_authorized<'life0, 'life1, 'async_trait>(
&'life0 self,
relay_msg: &'life1 RelayMessage
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
Defines the interface for incoming message flow authorization.
Examples
#[derive(Debug)]
pub struct IdentityIdAccessControl;
#[async_trait]
impl IncomingAccessControl for IdentityIdAccessControl {
async fn is_authorized(&self, relay_msg: &RelayMessage) -> Result<bool> {
// ...
// some authorization logic that returns one of:
// ockam_core::allow()
// ockam_core::deny()
// ...
}
}
Required Methods§
Return true if the message is allowed to pass, and false if not.