Skip to main content

SubscribeAuthorizer

Trait SubscribeAuthorizer 

Source
pub trait SubscribeAuthorizer: Send + Sync {
    // Required method
    fn authorize<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        peer: &'life1 PeerIdentity,
        track_name: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = SubscribeDecision> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn authorize_without_track_hook<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _peer: &'life1 PeerIdentity,
    ) -> Pin<Box<dyn Future<Output = SubscribeDecision> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Pluggable subscribe-time authorization hook for the moq accept path.

Implementors decide, given the (best-effort) peer identity and the hierarchical track name, whether a subscribe is permitted. The intended composition is: structural tenant scoping (tenant_scoped_consumer) gates visibility / cross-tenant enumeration, and this hook gates public-vs-private within what’s visible.

§Wiring status

Async because the MAC-backed authorizer revalidates credential-bearing cached subject contexts against the canonical revocation authority on every decision.

Required Methods§

Source

fn authorize<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, peer: &'life1 PeerIdentity, track_name: &'life2 str, ) -> Pin<Box<dyn Future<Output = SubscribeDecision> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Decide whether peer may subscribe to track_name.

Provided Methods§

Source

fn authorize_without_track_hook<'life0, 'life1, 'async_trait>( &'life0 self, _peer: &'life1 PeerIdentity, ) -> Pin<Box<dyn Future<Output = SubscribeDecision> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Decide admission while moq-net provides no track name callback (#276).

The default is deny. Implementations with an audit path should override this method to record the coarse session denial.

Implementors§