grafbase_sdk/host/
authorization_context.rs

1use crate::{wit, Token};
2
3/// Context available for authorization
4pub struct AuthorizationContext(wit::AuthorizationContext);
5
6impl From<wit::AuthorizationContext> for AuthorizationContext {
7    fn from(context: wit::AuthorizationContext) -> Self {
8        Self(context)
9    }
10}
11
12impl AuthorizationContext {
13    /// Gateway HTTP headers.
14    pub fn headers(&self) -> super::Headers {
15        self.0.headers().into()
16    }
17
18    /// Token produced by an authentication extension.
19    pub fn token(&self) -> Token {
20        self.0.token().into()
21    }
22}