r1_api_layer/server/
server_auth.rs

1use super::Service;
2use crate::{Api, AuthenticationApi};
3use swagger::{
4    auth::{Basic, Bearer},
5    ApiError, Authorization, Has, XSpanIdString,
6};
7
8impl<T, C> AuthenticationApi for Service<T, C>
9where
10    T: Api<C> + Clone + Send + 'static + AuthenticationApi,
11    C: Has<XSpanIdString> + Has<Option<Authorization>> + Send + Sync + 'static,
12{
13    /// Passthrough of the task to the api-implementation
14    fn bearer_authorization(&self, token: &Bearer) -> Result<Authorization, ApiError> {
15        self.api_impl.bearer_authorization(token)
16    }
17
18    /// Passthrough of the task to the api-implementation
19    fn apikey_authorization(&self, token: &str) -> Result<Authorization, ApiError> {
20        self.api_impl.apikey_authorization(token)
21    }
22
23    /// Passthrough of the task to the api-implementation
24    fn basic_authorization(&self, basic: &Basic) -> Result<Authorization, ApiError> {
25        self.api_impl.basic_authorization(basic)
26    }
27}