2015-03-27 20:43:23 +00:00
|
|
|
package audit
|
|
|
|
|
2015-04-01 20:54:50 +00:00
|
|
|
import "github.com/hashicorp/vault/logical"
|
|
|
|
|
2015-03-27 20:43:23 +00:00
|
|
|
// Backend interface must be implemented for an audit
|
|
|
|
// mechanism to be made available. Audit backends can be enabled to
|
|
|
|
// sink information to different backends such as logs, file, databases,
|
|
|
|
// or other external services.
|
|
|
|
type Backend interface {
|
2015-04-01 20:54:50 +00:00
|
|
|
// LogRequest is used to syncronously log a request. This is done after the
|
|
|
|
// request is authorized but before the request is executed.
|
|
|
|
LogRequest(*logical.Auth, *logical.Request) error
|
|
|
|
|
|
|
|
// LogResponse is used to syncronously log a response. This is done after
|
|
|
|
// the request is processed but before the response is sent.
|
|
|
|
LogResponse(*logical.Auth, *logical.Request, *logical.Response, error) error
|
2015-03-27 20:43:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Factory is the factory function to create an audit backend.
|
|
|
|
type Factory func(map[string]string) (Backend, error)
|