audit: add display name to auth [GH-176]

This commit is contained in:
Mitchell Hashimoto 2015-05-11 10:40:32 -07:00
parent 15d3d88c48
commit a9f8d6243c
2 changed files with 7 additions and 4 deletions

View File

@ -25,8 +25,9 @@ func (f *FormatJSON) FormatRequest(
Type: "request",
Auth: JSONAuth{
Policies: auth.Policies,
Metadata: auth.Metadata,
DisplayName: auth.DisplayName,
Policies: auth.Policies,
Metadata: auth.Metadata,
},
Request: JSONRequest{
@ -55,6 +56,7 @@ func (f *FormatJSON) FormatResponse(
if resp.Auth != nil {
respAuth = JSONAuth{
ClientToken: resp.Auth.ClientToken,
DisplayName: resp.Auth.DisplayName,
Policies: resp.Auth.Policies,
Metadata: resp.Auth.Metadata,
}
@ -122,7 +124,8 @@ type JSONResponse struct {
}
type JSONAuth struct {
ClientToken string `json:"string,omitempty"`
ClientToken string `json:"client_token,omitempty"`
DisplayName string `json:"display_name"`
Policies []string `json:"policies"`
Metadata map[string]string `json:"metadata"`
}

View File

@ -38,5 +38,5 @@ func TestFormatJSON_formatRequest(t *testing.T) {
}
}
const testFormatJSONReqBasicStr = `{"type":"request","auth":{"policies":["root"],"metadata":null},"request":{"operation":"write","path":"/foo","data":null}}
const testFormatJSONReqBasicStr = `{"type":"request","auth":{"display_name":"","policies":["root"],"metadata":null},"request":{"operation":"write","path":"/foo","data":null}}
`