Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
ede8c0ce
Commit
ede8c0ce
authored
Jul 27, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch custom warden events too to increment metrics
parent
656985bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
config/initializers/warden.rb
config/initializers/warden.rb
+15
-9
lib/gitlab/auth/activity.rb
lib/gitlab/auth/activity.rb
+0
-1
No files found.
config/initializers/warden.rb
View file @
ede8c0ce
Rails
.
application
.
configure
do
|
config
|
Warden
::
Manager
.
after_set_user
(
scope: :user
)
do
|
user
,
auth
,
opts
|
Gitlab
::
Auth
::
UniqueIpsLimiter
.
limit_user!
(
user
)
end
Warden
::
Manager
.
before_failure
(
scope: :user
)
do
|
env
,
opts
|
Gitlab
::
Auth
::
BlockedUserTracker
.
new
(
env
).
tap
do
|
tracker
|
tracker
.
log_blocked_user_activity!
if
tracker
.
user_blocked?
Gitlab
::
Auth
::
Activity
.
new
(
tracker
.
user
,
opts
).
user_authentication_failed!
case
opts
[
:event
]
when
:authentication
Gitlab
::
Auth
::
Activity
.
new
(
user
,
opts
).
user_authenticated!
when
:set_user
Gitlab
::
Auth
::
Activity
.
new
(
user
,
opts
).
user_authenticated!
Gitlab
::
Auth
::
Activity
.
new
(
user
,
opts
).
user_session_override!
when
:fetch
# no-op
else
Gitlab
::
Auth
::
Activity
.
new
(
user
,
opts
).
user_session_override!
end
end
Warden
::
Manager
.
after_authentication
(
scope: :user
)
do
|
user
,
auth
,
opts
|
ActiveSession
.
cleanup
(
user
)
Gitlab
::
Auth
::
Activity
.
new
(
user
,
opts
).
user_authenticated!
end
Warden
::
Manager
.
after_set_user
(
scope: :user
,
only: :fetch
)
do
|
user
,
auth
,
opts
|
ActiveSession
.
set
(
user
,
auth
.
request
)
end
Warden
::
Manager
.
after_set_user
(
scope: :user
,
only: :set_user
)
do
|
user
,
auth
,
opts
|
Gitlab
::
Auth
::
Activity
.
new
(
user
,
opts
).
user_session_override!
Warden
::
Manager
.
before_failure
(
scope: :user
)
do
|
env
,
opts
|
tracker
=
Gitlab
::
Auth
::
BlockedUserTracker
.
new
(
env
)
tracker
.
log_blocked_user_activity!
if
tracker
.
user_blocked?
Gitlab
::
Auth
::
Activity
.
new
(
tracker
.
user
,
opts
).
user_authentication_failed!
end
Warden
::
Manager
.
before_logout
(
scope: :user
)
do
|
user_warden
,
auth
,
opts
|
...
...
lib/gitlab/auth/activity.rb
View file @
ede8c0ce
...
...
@@ -42,7 +42,6 @@ module Gitlab
end
def
user_session_override!
self
.
class
.
user_authenticated_counter_increment!
self
.
class
.
user_session_override_counter_increment!
if
@opts
[
:message
]
==
:two_factor_authenticated
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment