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
Этот коммит содержится в:
@@ -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
|
||||
|
||||
Ссылка в новой задаче
Block a user