Add configurable vault security settings
This commit is contained in:
@@ -86,6 +86,11 @@ type RemoteOpenableSession interface {
|
||||
OpenRemote(webdav.Client, string, vault.MasterKey) error
|
||||
}
|
||||
|
||||
type SecurityConfigurableSession interface {
|
||||
ConfigureSecurity(vault.SecuritySettings) error
|
||||
SecuritySettings() vault.SecuritySettings
|
||||
}
|
||||
|
||||
type ApprovalManager interface {
|
||||
Pending() []apiapproval.Request
|
||||
Resolve(string, apiapproval.Outcome) (apiapproval.Request, *apitokens.PolicyRule, error)
|
||||
@@ -238,6 +243,26 @@ func (s *State) DeleteAPIToken(id string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *State) SecuritySettings() (vault.SecuritySettings, error) {
|
||||
security, ok := s.Session.(SecurityConfigurableSession)
|
||||
if !ok {
|
||||
return vault.SecuritySettings{}, fmt.Errorf("session does not expose security settings")
|
||||
}
|
||||
return security.SecuritySettings(), nil
|
||||
}
|
||||
|
||||
func (s *State) ConfigureSecurity(settings vault.SecuritySettings) error {
|
||||
security, ok := s.Session.(SecurityConfigurableSession)
|
||||
if !ok {
|
||||
return fmt.Errorf("session does not expose security settings")
|
||||
}
|
||||
if err := security.ConfigureSecurity(settings); err != nil {
|
||||
return err
|
||||
}
|
||||
s.Dirty = true
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *State) ShowSection(section Section) {
|
||||
s.Section = section
|
||||
s.CurrentPath = nil
|
||||
|
||||
Reference in New Issue
Block a user