FIX: add increased logging around when users are logged out

https://github.com/mozilla/discourse/issues/188
This commit is contained in:
Leo McArdle 2019-04-08 13:31:32 +01:00
Родитель 7b36d1ff86
Коммит 652d284ad0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 8262833620A64C3F
2 изменённых файлов: 12 добавлений и 7 удалений

Просмотреть файл

@ -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