Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
authserv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ai
authserv
Commits
a0a93185
Commit
a0a93185
authored
10 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
improve logging of auth events
parent
9f2bc780
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
authserv/app_main.py
+10
-6
10 additions, 6 deletions
authserv/app_main.py
authserv/app_nginx.py
+6
-4
6 additions, 4 deletions
authserv/app_nginx.py
with
16 additions
and
10 deletions
authserv/app_main.py
+
10
−
6
View file @
a0a93185
...
...
@@ -31,18 +31,22 @@ def api_auth():
check_ratelimit
(
request
,
username
,
source_ip
)
try
:
result
,
errmsg
,
unused_shard
=
do_auth
(
auth_status
,
errmsg
,
unused_shard
=
do_auth
(
username
,
service
,
shard
,
password
,
otp_token
,
source_ip
)
except
Exception
,
e
:
app
.
logger
.
exception
(
'
Unexpected exception in authenticate()
'
)
abort
(
500
)
app
.
logger
.
info
(
'
AUTH %s %s %s otp=%s%s
'
,
username
,
service
,
result
,
otp_token
and
'
y
'
or
'
n
'
,
(
'
err=%s
'
%
errmsg
)
if
errmsg
else
''
)
# Build a nice log message.
log_parts
=
[
username
,
service
,
auth_status
]
log_parts
.
append
(
'
otp=%s
'
%
(
otp_token
and
'
y
'
or
'
n
'
))
if
shard
:
log_parts
.
append
(
'
shard=%s
'
%
shard
)
if
errmsg
:
log_parts
.
append
(
'
err=%s
'
%
errmsg
)
app
.
logger
.
info
(
'
AUTH %s
'
,
'
'
.
join
(
log_parts
))
response
=
make_response
(
result
)
response
=
make_response
(
auth_status
)
response
.
headers
[
'
Cache-Control
'
]
=
'
no-cache
'
response
.
headers
[
'
Content-Type
'
]
=
'
text/plain
'
response
.
headers
[
'
Expires
'
]
=
'
-1
'
...
...
This diff is collapsed.
Click to expand it.
authserv/app_nginx.py
+
6
−
4
View file @
a0a93185
...
...
@@ -40,10 +40,12 @@ def do_nginx_http_auth():
app
.
logger
.
exception
(
'
Unexpected exception in authenticate()
'
)
abort
(
500
)
app
.
logger
.
info
(
'
NGINX_AUTH %s %s %s shard=%s%s
'
,
username
,
service
,
auth_status
,
shard
,
(
'
err=%s
'
%
errmsg
)
if
errmsg
else
''
)
log_parts
=
[
username
,
service
,
auth_status
]
if
shard
:
log_parts
.
append
(
'
-> shard=%s
'
%
shard
)
if
errmsg
:
log_parts
.
append
(
'
err=%s
'
%
errmsg
)
app
.
logger
.
info
(
'
NGINX_AUTH %s
'
,
'
'
.
join
(
log_parts
))
response
=
make_response
(
''
)
if
auth_status
==
'
OK
'
:
...
...
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