mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 02:02:43 +00:00
VAULT-25710: Audit - enforce header formatter requirement in EntryFormatter (#26239)
* Check Enterprise unseal order for audit funcs, enforce header formatter in audit entry formatter node * ApplyConfig return empty headers (but never nil) when nil/empty supplied * Add NoopHeaderFormatter and remove builtin audit testHeaderFormatters
This commit is contained in:
@@ -5,7 +5,6 @@ package audit
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -15,16 +14,15 @@ type Option func(*options) error
|
||||
|
||||
// options are used to represent configuration for a audit related nodes.
|
||||
type options struct {
|
||||
withID string
|
||||
withNow time.Time
|
||||
withSubtype subtype
|
||||
withFormat format
|
||||
withPrefix string
|
||||
withRaw bool
|
||||
withElision bool
|
||||
withOmitTime bool
|
||||
withHMACAccessor bool
|
||||
withHeaderFormatter HeaderFormatter
|
||||
withID string
|
||||
withNow time.Time
|
||||
withSubtype subtype
|
||||
withFormat format
|
||||
withPrefix string
|
||||
withRaw bool
|
||||
withElision bool
|
||||
withOmitTime bool
|
||||
withHMACAccessor bool
|
||||
}
|
||||
|
||||
// getDefaultOptions returns options with their default values.
|
||||
@@ -163,15 +161,3 @@ func WithHMACAccessor(h bool) Option {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithHeaderFormatter provides an Option to supply a HeaderFormatter.
|
||||
// If the HeaderFormatter interface supplied is nil (type or value), the option will not be applied.
|
||||
func WithHeaderFormatter(f HeaderFormatter) Option {
|
||||
return func(o *options) error {
|
||||
if f != nil && !reflect.ValueOf(f).IsNil() {
|
||||
o.withHeaderFormatter = f
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user