FIX: add increased logging around when users are logged out
https://github.com/mozilla/discourse/issues/188
This commit is contained in:
Родитель
7b36d1ff86
Коммит
652d284ad0
|
@ -27,19 +27,24 @@ module MozillaIAM
|
||||||
end
|
end
|
||||||
|
|
||||||
if last_refresh + logout_delay < Time.now
|
if last_refresh + logout_delay < Time.now
|
||||||
reset_session
|
raise <<~EOF
|
||||||
log_off_user
|
Mozilla IAM: User session expired
|
||||||
|
user_id: #{current_user.id}, last_refresh: #{last_refresh}, logout_delay: #{logout_delay}
|
||||||
|
EOF
|
||||||
else
|
else
|
||||||
refresh_iam_session
|
refresh_iam_session
|
||||||
unless Profile.for(current_user).is_aal_enough?(session[:mozilla_iam].try(:[], :aal))
|
aal = session[:mozilla_iam].try(:[], :aal)
|
||||||
reset_session
|
unless Profile.for(current_user).is_aal_enough?(aal)
|
||||||
log_off_user
|
raise <<~EOF
|
||||||
|
Mozilla IAM: AAL not enough, user logged out
|
||||||
|
user_id: #{current_user.id}, aal: #{aal}
|
||||||
|
EOF
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
|
Rails.logger.warn("Killed session for user #{current_user.id}: #{e.class} (#{e.message})\n#{e.backtrace.join("\n")}")
|
||||||
reset_session
|
reset_session
|
||||||
log_off_user
|
log_off_user
|
||||||
raise e
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# name: mozilla-iam
|
# name: mozilla-iam
|
||||||
# about: A plugin to integrate Discourse with Mozilla's Identity and Access Management (IAM) system
|
# about: A plugin to integrate Discourse with Mozilla's Identity and Access Management (IAM) system
|
||||||
# version: 1.1.2
|
# version: 1.1.3
|
||||||
# authors: Leo McArdle
|
# authors: Leo McArdle
|
||||||
# url: https://github.com/mozilla/discourse-mozilla-iam
|
# url: https://github.com/mozilla/discourse-mozilla-iam
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче