pub struct ConnectionStringConfig {
pub value: String,
pub encrypted_value: Option<String>,
pub encryption_salt: Option<String>,
}Expand description
Configuration for connection string authentication.
Contains the Service Bus connection string used for direct authentication using Shared Access Signatures (SAS). This is the simplest authentication method but requires managing connection strings securely.
§Required Fields
value- Complete Azure Service Bus connection string with access credentials
§Connection String Format
The connection string must include:
Endpoint- Service Bus namespace endpointSharedAccessKeyName- Name of the shared access keySharedAccessKey- The shared access key value
§Examples
use quetty_server::auth::types::ConnectionStringConfig;
let config = ConnectionStringConfig {
value: "Endpoint=sb://my-namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=abcd1234...".to_string(),
};§Security Considerations
- Store connection strings securely (environment variables, key vault, etc.)
- Use principle of least privilege - avoid “RootManageSharedAccessKey” in production
- Rotate access keys regularly
- Consider using Azure AD authentication for enhanced security
Fields§
§value: StringThe Azure Service Bus connection string (REQUIRED) Must include Endpoint, SharedAccessKeyName, and SharedAccessKey
encrypted_value: Option<String>Encrypted connection string (alternative to value)
encryption_salt: Option<String>Salt for connection string encryption (required when encrypted_value is used)
Implementations§
Source§impl ConnectionStringConfig
impl ConnectionStringConfig
Sourcepub fn get_connection_string(
&self,
password: Option<&str>,
) -> Result<String, EncryptionError>
pub fn get_connection_string( &self, password: Option<&str>, ) -> Result<String, EncryptionError>
Returns the actual connection string, decrypting if necessary
Sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
Returns true if this config contains encrypted data
Sourcepub fn encrypt_with_password(
&mut self,
password: &str,
) -> Result<(), EncryptionError>
pub fn encrypt_with_password( &mut self, password: &str, ) -> Result<(), EncryptionError>
Encrypts the connection string with the given password
Trait Implementations§
Source§impl Clone for ConnectionStringConfig
impl Clone for ConnectionStringConfig
Source§fn clone(&self) -> ConnectionStringConfig
fn clone(&self) -> ConnectionStringConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConnectionStringConfig
impl Debug for ConnectionStringConfig
Source§impl Default for ConnectionStringConfig
impl Default for ConnectionStringConfig
Source§fn default() -> ConnectionStringConfig
fn default() -> ConnectionStringConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ConnectionStringConfig
impl<'de> Deserialize<'de> for ConnectionStringConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ConnectionStringConfig
impl RefUnwindSafe for ConnectionStringConfig
impl Send for ConnectionStringConfig
impl Sync for ConnectionStringConfig
impl Unpin for ConnectionStringConfig
impl UnwindSafe for ConnectionStringConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more