MM-53165 Add X-Forwarded-For header to audit for rest api calls (#24390)

* Add X-Forwarded-For header to audit for rest api calls

* fix unit test
Этот коммит содержится в:
Doug Lauder
2023-08-28 07:24:55 -04:00
коммит произвёл GitHub
родитель 0a499770e6
Коммит 84b52333c1
6 изменённых файлов: 28 добавлений и 15 удалений

Просмотреть файл

@@ -89,10 +89,11 @@ func (a *App) MakeAuditRecord(event string, initialStatus string) *audit.Record
audit.KeyClusterID: a.GetClusterId(),
},
Actor: audit.EventActor{
UserId: userID,
SessionId: "",
Client: fmt.Sprintf("server %s-%s", model.BuildNumber, model.BuildHash),
IpAddress: "",
UserId: userID,
SessionId: "",
Client: fmt.Sprintf("server %s-%s", model.BuildNumber, model.BuildHash),
IpAddress: "",
XForwardedFor: "",
},
EventData: audit.EventData{
Parameters: map[string]interface{}{},

Просмотреть файл

@@ -16,6 +16,7 @@ type Context struct {
session model.Session
requestId string
ipAddress string
xForwardedFor string
path string
userAgent string
acceptLanguage string
@@ -58,6 +59,9 @@ func (c *Context) RequestId() string {
func (c *Context) IPAddress() string {
return c.ipAddress
}
func (c *Context) XForwardedFor() string {
return c.xForwardedFor
}
func (c *Context) Path() string {
return c.path
}
@@ -85,6 +89,9 @@ func (c *Context) SetRequestId(s string) {
func (c *Context) SetIPAddress(s string) {
c.ipAddress = s
}
func (c *Context) SetXForwardedFor(s string) {
c.xForwardedFor = s
}
func (c *Context) SetUserAgent(s string) {
c.userAgent = s
}
@@ -123,6 +130,7 @@ type CTX interface {
Session() *model.Session
RequestId() string
IPAddress() string
XForwardedFor() string
Path() string
UserAgent() string
AcceptLanguage() string