open-vault/logical/system_view.go

38 lines
1 KiB
Go
Raw Normal View History

package logical
import "time"
// SystemView exposes system configuration information in a safe way
// for logical backends to consume
type SystemView interface {
2015-08-27 16:14:03 +00:00
// DefaultLeaseTTL returns the default lease TTL set in Vault configuration
DefaultLeaseTTL() time.Duration
2015-08-27 16:14:03 +00:00
// MaxLeaseTTL returns the max lease TTL set in Vault configuration; backend
// authors should take care not to issue credentials that last longer than
// this value, as Vault will revoke them
MaxLeaseTTL() time.Duration
2015-09-21 14:04:03 +00:00
// SudoPrivilege returns true if given path has sudo privileges
// for the given client token
SudoPrivilege(path string, token string) bool
}
type StaticSystemView struct {
DefaultLeaseTTLVal time.Duration
MaxLeaseTTLVal time.Duration
SudoPrivilegeVal bool
}
func (d StaticSystemView) DefaultLeaseTTL() time.Duration {
return d.DefaultLeaseTTLVal
}
func (d StaticSystemView) MaxLeaseTTL() time.Duration {
return d.MaxLeaseTTLVal
}
2015-09-21 14:04:03 +00:00
func (d StaticSystemView) SudoPrivilege(path string, token string) bool {
return d.SudoPrivilegeVal
}