mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 11:38:02 +00:00
Allow plugins to submit audit requests/responses via extended SystemView (#6777)
Move audit.LogInput to sdk/logical. Allow the Data values in audited logical.Request and Response to implement OptMarshaler, in which case we delegate hashing/serializing responsibility to them. Add new ClientCertificateSerialNumber audit request field. SystemView can now be cast to ExtendedSystemView to expose the Auditor interface, which allows submitting requests and responses to the audit broker.
This commit is contained in:
@@ -70,6 +70,10 @@ type SystemView interface {
|
||||
PluginEnv(context.Context) (*PluginEnvironment, error)
|
||||
}
|
||||
|
||||
type ExtendedSystemView interface {
|
||||
Auditor() Auditor
|
||||
}
|
||||
|
||||
type StaticSystemView struct {
|
||||
DefaultLeaseTTLVal time.Duration
|
||||
MaxLeaseTTLVal time.Duration
|
||||
@@ -86,6 +90,20 @@ type StaticSystemView struct {
|
||||
PluginEnvironment *PluginEnvironment
|
||||
}
|
||||
|
||||
type noopAuditor struct{}
|
||||
|
||||
func (a noopAuditor) AuditRequest(ctx context.Context, input *LogInput) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a noopAuditor) AuditResponse(ctx context.Context, input *LogInput) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d StaticSystemView) Auditor() Auditor {
|
||||
return noopAuditor{}
|
||||
}
|
||||
|
||||
func (d StaticSystemView) DefaultLeaseTTL() time.Duration {
|
||||
return d.DefaultLeaseTTLVal
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user