Skip to content
Snippets Groups Projects
Commit b225e39a authored by Francé Wilke's avatar Francé Wilke
Browse files

Use ip_utils.GetRequestSourceIP when getting the source IP

parent a72b2ef1
No related branches found
Tags v1.283.0
No related merge requests found
......@@ -2,6 +2,7 @@ package api_logs
import (
"github.com/thoas/go-funk"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/ip_utils"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/number_utils"
"net/url"
"strings"
......@@ -80,7 +81,7 @@ func GenerateIncomingAPILog(startTime time.Time, requestID *string, claim map[st
RequestID: currentRequestID,
InitialAuthType: authType,
InitialAuthUsername: authUsername,
SourceIP: req.RequestContext.Identity.SourceIP,
SourceIP: ip_utils.GetRequestSourceIP(&req, nil),
UserAgent: req.RequestContext.Identity.UserAgent,
UserID: userID,
Username: username,
......
......@@ -10,6 +10,7 @@ import (
"github.com/thoas/go-funk"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/date_utils"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/handler_utils"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/ip_utils"
"time"
)
......@@ -30,7 +31,7 @@ func SignSessionTokenWithKey(secretKey string, sessionTokenString string) string
// GetSessionTokenString creates a unique session token string from the API request.
func GetSessionTokenString(request events.APIGatewayProxyRequest) (string, error) {
sessionToken := SessionToken{
IP: request.RequestContext.Identity.SourceIP,
IP: ip_utils.GetRequestSourceIP(&request, nil),
UserAgent: handler_utils.FindHeaderValue(request.Headers, "user-agent"),
TimeCreated: date_utils.CurrentDate().Round(time.Second),
Token: uuid.New().String(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment