diff options
author | Achilleas Pipinellis <axilleas@axilleas.me> | 2015-12-25 01:31:02 +0200 |
---|---|---|
committer | Achilleas Pipinellis <axilleas@axilleas.me> | 2015-12-25 01:31:02 +0200 |
commit | d18fd3f6489ad2a8065f8ddd80ca51100eb50b5e (patch) | |
tree | 1e809b9c4f694e20e9cc7dff06a9cb7f2f56aef2 /app/controllers/application_controller.rb | |
parent | e74affcfa84acaddc236d6dfed7be1a61470dc0e (diff) | |
parent | 350d65503f0fa34ae397942578c5ea8b2a46a629 (diff) | |
download | gitlab-ce-d18fd3f6489ad2a8065f8ddd80ca51100eb50b5e.tar.gz |
Merge branch 'master' into ci_triggers_docsci_triggers_docs
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0d182e8eb04..01e2e7b2f98 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -10,6 +10,7 @@ class ApplicationController < ActionController::Base before_action :authenticate_user_from_token! before_action :authenticate_user! + before_action :validate_user_service_ticket! before_action :reject_blocked! before_action :check_password_expiration before_action :ldap_security_check @@ -202,6 +203,20 @@ class ApplicationController < ActionController::Base end end + def validate_user_service_ticket! + return unless signed_in? && session[:service_tickets] + + valid = session[:service_tickets].all? do |provider, ticket| + Gitlab::OAuth::Session.valid?(provider, ticket) + end + + unless valid + session[:service_tickets] = nil + sign_out current_user + redirect_to new_user_session_path + end + end + def check_password_expiration if current_user && current_user.password_expires_at && current_user.password_expires_at < Time.now && !current_user.ldap_user? redirect_to new_profile_password_path and return |