AzureAdAuthConfig

Struct AzureAdAuthConfig 

Source
pub struct AzureAdAuthConfig {
    pub auth_method: String,
    pub tenant_id: Option<String>,
    pub client_id: Option<String>,
    pub client_secret: Option<String>,
    pub encrypted_client_secret: Option<String>,
    pub client_secret_encryption_salt: Option<String>,
    pub subscription_id: Option<String>,
    pub resource_group: Option<String>,
    pub namespace: Option<String>,
    pub authority_host: Option<String>,
    pub scope: Option<String>,
}
Expand description

Configuration for Azure Active Directory authentication.

Contains all necessary parameters for Azure AD authentication flows including Device Code Flow and Client Credentials Flow.

§Required Fields

  • auth_method - Must be “device_code” or “client_secret”

§Required for Device Code Flow

  • tenant_id - Azure AD tenant ID
  • client_id - Azure AD application (client) ID

§Required for Client Credentials Flow

  • tenant_id - Azure AD tenant ID
  • client_id - Azure AD application (client) ID
  • client_secret - Azure AD application client secret

§Optional Fields

  • subscription_id - For resource discovery (defaults to env AZURE_SUBSCRIPTION_ID)
  • resource_group - For resource discovery (defaults to auto-discovery)
  • namespace - Service Bus namespace (defaults to auto-discovery)
  • authority_host - Azure AD authority host (defaults to https://login.microsoftonline.com)
  • scope - OAuth scope (defaults to https://servicebus.azure.net/.default)

§Examples

§Device Code Flow Configuration

use quetty_server::auth::types::AzureAdAuthConfig;

let config = AzureAdAuthConfig {
    auth_method: "device_code".to_string(),
    tenant_id: Some("your-tenant-id".to_string()),
    client_id: Some("your-client-id".to_string()),
    client_secret: None, // Not needed for device code flow
    subscription_id: Some("your-subscription-id".to_string()),
    resource_group: Some("your-resource-group".to_string()),
    namespace: Some("your-servicebus-namespace".to_string()),
    authority_host: None, // Uses default
    scope: None, // Uses default
};

§Client Credentials Flow Configuration

use quetty_server::auth::types::AzureAdAuthConfig;

let config = AzureAdAuthConfig {
    auth_method: "client_secret".to_string(),
    tenant_id: Some("your-tenant-id".to_string()),
    client_id: Some("your-client-id".to_string()),
    client_secret: Some("your-client-secret".to_string()), // Required
    subscription_id: None, // Optional
    resource_group: None, // Optional
    namespace: None, // Optional
    authority_host: None, // Uses default
    scope: None, // Uses default
};

Fields§

§auth_method: String

Authentication method: “device_code” or “client_secret” (REQUIRED)

§tenant_id: Option<String>

Azure AD tenant ID (REQUIRED for all flows)

§client_id: Option<String>

Azure AD application (client) ID (REQUIRED for all flows)

§client_secret: Option<String>

Azure AD application client secret (REQUIRED for client_secret flow)

§encrypted_client_secret: Option<String>

Encrypted client secret (alternative to client_secret)

§client_secret_encryption_salt: Option<String>

Salt for client secret encryption (required when encrypted_client_secret is used)

§subscription_id: Option<String>

Azure subscription ID (OPTIONAL - defaults to env AZURE_SUBSCRIPTION_ID)

§resource_group: Option<String>

Resource group name (OPTIONAL - defaults to auto-discovery)

§namespace: Option<String>

Service Bus namespace name (OPTIONAL - defaults to auto-discovery)

§authority_host: Option<String>

Azure AD authority host URL (OPTIONAL - defaults to https://login.microsoftonline.com)

§scope: Option<String>

OAuth scope for token requests (OPTIONAL - defaults to https://servicebus.azure.net/.default)

Implementations§

Source§

impl AzureAdAuthConfig

Source

pub fn get_client_secret( &self, password: Option<&str>, ) -> Result<Option<String>, EncryptionError>

Returns the actual client secret, decrypting if necessary

Source

pub fn has_encrypted_client_secret(&self) -> bool

Returns true if this config contains encrypted client secret

Source

pub fn has_encrypted_data(&self) -> bool

Returns true if any encrypted data is present in this config

Source

pub fn encrypt_client_secret_with_password( &mut self, password: &str, ) -> Result<(), EncryptionError>

Encrypts the client secret with the given password

Trait Implementations§

Source§

impl Clone for AzureAdAuthConfig

Source§

fn clone(&self) -> AzureAdAuthConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AzureAdAuthConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AzureAdAuthConfig

Source§

fn default() -> AzureAdAuthConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for AzureAdAuthConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for AzureAdAuthConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<D> DeserializeWith<JsonFormat> for D

Source§

fn deserialize_with<'async_trait>( body: ResponseBody, ) -> Pin<Box<dyn Future<Output = Result<D, Error>> + Send + 'async_trait>>
where D: 'async_trait,

Source§

impl<D> DeserializeWith<JsonFormat> for D

Source§

fn deserialize_with<'async_trait>( body: ResponseBody, ) -> Pin<Box<dyn Future<Output = Result<D, Error>> + Send + 'async_trait>>
where D: 'async_trait,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> SendBound for T
where T: Send,