Skip to main content

resolve_auth_mode

Function resolve_auth_mode 

Source
pub fn resolve_auth_mode(settings: &Settings) -> AuthMode
Expand description

What: Resolve the effective authentication mode from settings.

Inputs:

  • settings: Reference to the application settings.

Output:

  • The resolved AuthMode to use for privilege escalation.

Details:

  • If auth_mode is explicitly set to something other than the default (Prompt), it takes precedence.
  • If auth_mode is Prompt (the default) and the legacy use_passwordless_sudo is true, maps to PasswordlessOnly for backward compatibility and logs a deprecation warning.
  • When both auth_mode != Prompt and use_passwordless_sudo = true are set, auth_mode wins and a deprecation warning is logged.