feat(vault-tui): implement KV client and service for managing secrets
- Added internal/vault/client.go for creating a Vault client with configuration settings. - Introduced internal/vault/errors.go to classify Vault API errors for better UI handling. - Created internal/vault/kv.go to manage KV secrets, including listing, reading, writing, and deleting operations. - Implemented internal/vault/mounts.go to list and describe secret engine mounts. - Developed internal/vault/service.go to provide a unified entry point for Vault operations. - Added internal/vault/kv_test.go for comprehensive testing of KV operations. - Introduced internal/ui/toast.go for transient notifications in the UI. - Added renovate.json for dependency management and updates.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"git.morlana.online/f.weber/vault-tui/internal/auth"
|
||||
"git.morlana.online/f.weber/vault-tui/internal/auth/oidc"
|
||||
)
|
||||
|
||||
// init registers a default-configured OIDC method so it appears in
|
||||
// auth.Default() for listing/help purposes. app.Method special-cases
|
||||
// "oidc" to build a fresh oidc.Method from the profile's actual settings
|
||||
// (see oidcMethod below) instead of using this registered instance, because
|
||||
// OIDC's port/callback/timeout are meaningfully per-profile.
|
||||
func init() {
|
||||
auth.Register(oidc.Method{})
|
||||
}
|
||||
|
||||
func (a *App) oidcMethod() auth.Method {
|
||||
o := a.Settings.Auth.OIDC
|
||||
cfg := oidc.Config{
|
||||
Mount: a.Settings.Auth.Mount,
|
||||
Role: a.Settings.Auth.Params["role"],
|
||||
ListenAddress: o.ListenAddress,
|
||||
CallbackMethod: o.CallbackMethod,
|
||||
CallbackHost: o.CallbackHost,
|
||||
CallbackPath: o.CallbackPath,
|
||||
BrowserCommand: a.Settings.BrowserCommand,
|
||||
}
|
||||
if o.Port != nil {
|
||||
cfg.Port = *o.Port
|
||||
}
|
||||
if o.CallbackPort != nil {
|
||||
cfg.CallbackPort = *o.CallbackPort
|
||||
}
|
||||
if o.SkipBrowser != nil {
|
||||
cfg.SkipBrowser = *o.SkipBrowser
|
||||
}
|
||||
if o.AbortOnBrowserError != nil {
|
||||
cfg.AbortOnBrowserError = *o.AbortOnBrowserError
|
||||
}
|
||||
if o.Timeout != nil {
|
||||
cfg.Timeout = *o.Timeout
|
||||
}
|
||||
if cfg.Mount == "" {
|
||||
cfg.Mount = "oidc"
|
||||
}
|
||||
return oidc.Method{Cfg: cfg}
|
||||
}
|
||||
Reference in New Issue
Block a user