1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
use AuthType;
use crateServiceBusError;
use async_trait;
/// Authentication token containing access credentials for Azure Service Bus.
///
/// This struct represents an authentication token obtained from Azure AD
/// that can be used to authenticate with Azure Service Bus resources.
/// Trait for authentication providers that can obtain Azure AD tokens.
///
/// This trait defines the interface for different authentication methods
/// (Device Code Flow, Client Credentials, Connection String) to obtain
/// access tokens for Azure Service Bus operations.
///
/// # Examples
///
/// ```no_run
/// use quetty_server::auth::provider::{AuthProvider, AuthToken};
/// use quetty_server::auth::types::AuthType;
/// use quetty_server::service_bus_manager::ServiceBusError;
/// use async_trait::async_trait;
///
/// struct MyAuthProvider;
///
/// #[async_trait]
/// impl AuthProvider for MyAuthProvider {
/// async fn authenticate(&self) -> Result<AuthToken, ServiceBusError> {
/// // Implementation specific authentication logic
/// Ok(AuthToken {
/// token: "example_token".to_string(),
/// token_type: "Bearer".to_string(),
/// expires_in_secs: Some(3600),
/// })
/// }
///
/// fn auth_type(&self) -> AuthType {
/// AuthType::AzureAd
/// }
/// }
/// ```