hocuspocus_rs_ws/authenticator/
simple.rs

1use anyhow::Result;
2use async_trait::async_trait;
3
4use crate::client_connection::DocConnectionConfig;
5
6use super::Authenticator;
7
8#[derive(Debug, Default)]
9pub struct SimpleAuthenticator;
10
11impl SimpleAuthenticator {
12    pub fn new() -> Self {
13        Self
14    }
15}
16
17#[async_trait]
18impl Authenticator for SimpleAuthenticator {
19    async fn authenticate(
20        &self,
21        _doc_id: &str,
22        _token: &str,
23    ) -> Result<DocConnectionConfig> {
24        Ok(DocConnectionConfig {
25            is_authenticated: true,
26            ..DocConnectionConfig::default()
27        })
28    }
29}