32 lines
1.1 KiB
Text
32 lines
1.1 KiB
Text
|
|
use platform/config/accessor.nu [config-get]
|
||
|
|
export use ../plugins_lib/auth_impl.nu [
|
||
|
|
check-auth-for-destructive check-auth-for-production check-operation-auth
|
||
|
|
get-api-key-interactive get-auth-metadata get-authenticated-user
|
||
|
|
get-provider-credentials-interactive get-secret-config-interactive
|
||
|
|
is-authenticated is-check-mode is-destructive-operation is-mfa-verified
|
||
|
|
log-authenticated-operation login-interactive mfa-enroll-interactive
|
||
|
|
print-auth-status require-auth require-mfa run-typedialog-auth-form
|
||
|
|
should-enforce-auth-from-metadata should-require-auth
|
||
|
|
should-require-mfa-destructive should-require-mfa-prod
|
||
|
|
]
|
||
|
|
|
||
|
|
def is-plugin-available [] {
|
||
|
|
let installed = (version | get installed_plugins)
|
||
|
|
$installed | str contains "auth"
|
||
|
|
}
|
||
|
|
|
||
|
|
def is-plugin-enabled [] {
|
||
|
|
config-get "plugins.auth_enabled" true
|
||
|
|
}
|
||
|
|
|
||
|
|
export def plugin-auth-status [] {
|
||
|
|
let plugin_available = is-plugin-available
|
||
|
|
let plugin_enabled = is-plugin-enabled
|
||
|
|
|
||
|
|
{
|
||
|
|
plugin_available: $plugin_available
|
||
|
|
plugin_enabled: $plugin_enabled
|
||
|
|
mode: (if ($plugin_enabled and $plugin_available) { "plugin" } else { "disabled" })
|
||
|
|
}
|
||
|
|
}
|