pub struct ConnectionStringProvider { /* private fields */ }Implementations§
Source§impl ConnectionStringProvider
impl ConnectionStringProvider
Sourcepub fn new(config: ConnectionStringConfig) -> Result<Self, ServiceBusError>
pub fn new(config: ConnectionStringConfig) -> Result<Self, ServiceBusError>
Creates a new ConnectionStringProvider from a connection string configuration.
Parses the connection string to extract the namespace, shared access key name, and shared access key. Validates that all required components are present.
§Arguments
config- Configuration containing the Service Bus connection string
§Returns
A configured ConnectionStringProvider ready for authentication
§Errors
Returns ServiceBusError::ConfigurationError if:
- Connection string is empty
- Connection string is missing required components (Endpoint, SharedAccessKeyName, SharedAccessKey)
- Connection string format is invalid
§Examples
use quetty_server::auth::{ConnectionStringProvider, ConnectionStringConfig};
let config = ConnectionStringConfig {
value: "Endpoint=sb://test.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=abc123".to_string(),
};
let provider = ConnectionStringProvider::new(config)?;Sourcepub fn connection_string(&self) -> &str
pub fn connection_string(&self) -> &str
Gets the original connection string value.
§Returns
The complete connection string as provided in the configuration
Trait Implementations§
Source§impl AuthProvider for ConnectionStringProvider
impl AuthProvider for ConnectionStringProvider
Source§fn authenticate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AuthToken, ServiceBusError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn authenticate<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AuthToken, ServiceBusError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Authenticates using the connection string by generating a SAS token.
Creates a time-limited SAS token (24 hours) using the shared access key from the connection string. The token can be used to authenticate Service Bus operations.
§Returns
An AuthToken containing the SAS-based connection string and expiration
§Errors
Returns ServiceBusError if SAS token generation fails
Source§fn auth_type(&self) -> AuthType
fn auth_type(&self) -> AuthType
Returns the authentication type for this provider.
§Returns
AuthType::ConnectionString indicating connection string authentication
Source§fn requires_refresh(&self) -> bool
fn requires_refresh(&self) -> bool
Indicates whether this provider’s tokens require periodic refresh.
Connection string authentication uses SAS tokens that expire, so refresh is required.
§Returns
true because SAS tokens have limited validity
Source§impl Clone for ConnectionStringProvider
impl Clone for ConnectionStringProvider
Source§fn clone(&self) -> ConnectionStringProvider
fn clone(&self) -> ConnectionStringProvider
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more