Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bobgroup-go-utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bob Public Utils
bobgroup-go-utils
Commits
b225e39a
Commit
b225e39a
authored
1 month ago
by
Francé Wilke
Browse files
Options
Downloads
Patches
Plain Diff
Use ip_utils.GetRequestSourceIP when getting the source IP
parent
a72b2ef1
No related branches found
Branches containing commit
Tags
v1.283.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api_logs/api-logs.go
+2
-1
2 additions, 1 deletion
api_logs/api-logs.go
auth/session.go
+2
-1
2 additions, 1 deletion
auth/session.go
with
4 additions
and
2 deletions
api_logs/api-logs.go
+
2
−
1
View file @
b225e39a
...
...
@@ -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
,
...
...
This diff is collapsed.
Click to expand it.
auth/session.go
+
2
−
1
View file @
b225e39a
...
...
@@ -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
(),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment