pub trait OutgoingAccessControl: Debug + Send + Sync + 'static {
    // Required method
    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 outgoing message flow authorization.

Examples

#[derive(Debug)]
pub struct LocalAccessControl;

#[async_trait]
impl OutgoingAccessControl for LocalAccessControl {
    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§

source

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,

Return true if the message is allowed to pass, and false if not.

Implementors§