Logging authentication errors and bad token usage

This commit is contained in:
Nate Brown
2015-06-18 18:30:18 -07:00
parent 314eea7ff0
commit 71a738ad7d
9 changed files with 29 additions and 15 deletions

View File

@@ -52,7 +52,7 @@ type Backend struct {
logRaw bool
}
func (b *Backend) LogRequest(auth *logical.Auth, req *logical.Request) error {
func (b *Backend) LogRequest(auth *logical.Auth, req *logical.Request, outerErr error) error {
if !b.logRaw {
// Copy the structures
cp, err := copystructure.Copy(auth)
@@ -79,7 +79,7 @@ func (b *Backend) LogRequest(auth *logical.Auth, req *logical.Request) error {
// Encode the entry as JSON
var buf bytes.Buffer
var format audit.FormatJSON
if err := format.FormatRequest(&buf, auth, req); err != nil {
if err := format.FormatRequest(&buf, auth, req, outerErr); err != nil {
return err
}