shifty-backend/service/src/user_service.rs
Simon Goller b0000c0117 Wrap Context with Autentication enum
Context should contain information which is required to get
the information if the service call is authenticated.  Context
could be the username for example.  But services call other
services internally and for this, authentication must not be
checked.  In this case, they can now pass Authentication::Full
which always successfully authenticates.
2024-05-09 14:58:19 +02:00

15 lines
360 B
Rust

use std::sync::Arc;
use std::fmt::Debug;
use async_trait::async_trait;
use mockall::automock;
use crate::ServiceError;
#[automock(type Context=();)]
#[async_trait]
pub trait UserService {
type Context: Clone + Debug + PartialEq + Eq + Send + Sync + 'static;
async fn current_user(&self, context: Self::Context) -> Result<Arc<str>, ServiceError>;
}