pub trait AccessControl: Debug + Send + Sync + 'static {
    fn is_authorized<'life0, 'life1, 'async_trait>(
        &'life0 self,
        local_msg: &'life1 LocalMessage
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; }
Expand description

Defines the interface for message flow authorization.

Examples

#[derive(Debug)]
pub struct IdentityIdAccessControl;

#[async_trait]
impl AccessControl for IdentityIdAccessControl {
    async fn is_authorized(&self, local_msg: &LocalMessage) -> 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.

Implementors