Skip to main content

tablo_core/auth/config/
debug.rs

1//! How an [`Auth`] prints: what it turns on, never the seams' own state.
2
3use super::{Auth, AuthConfig};
4
5impl<U> std::fmt::Debug for Auth<U> {
6    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7        self.config.fmt(f)
8    }
9}
10
11impl std::fmt::Debug for AuthConfig {
12    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13        if self.is_disabled() {
14            f.write_str("Auth::disabled")
15        } else {
16            let mut debug = f.debug_struct("Auth");
17            debug
18                .field("throttle", &self.throttle)
19                .field("account_throttle", &self.account_throttle)
20                .field("registration", &self.registrar.is_some())
21                .field("profile", &self.profile_editor.is_some())
22                .field("password_reset", &self.reset)
23                .field("email_verification", &self.verification)
24                .field("tenant_registration", &self.tenant_registration)
25                .field("tenant_profile", &self.tenant_editor.is_some())
26                .field("impersonation", &self.impersonation)
27                .field("oidc", &self.oidc)
28                .field("mail", &self.mail)
29                .field("sessions", &self.sessions);
30            #[cfg(feature = "two-factor")]
31            debug.field("two_factor", &self.two_factor);
32            debug.finish_non_exhaustive()
33        }
34    }
35}