Skip to content

Commit

Permalink
Disable SSO parity for non-exopps users (#789)
Browse files Browse the repository at this point in the history
* Bugfix bypass sso parity on api endpoints (#784)

* Bypass sso parity on API endpoints

* Add skip_before_action callbacks to controllers where SSO parity is not needed

* Block enquiries and enquiry responses for maintenance (#785)

* Disable SSO parity enforcement (#787)

* Remove skip hooks
  • Loading branch information
rafa-garcia authored Jun 10, 2021
1 parent 71e8d7e commit 77cca42
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 13 deletions.
1 change: 0 additions & 1 deletion app/controllers/admin/base_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class Admin::BaseController < ApplicationController
include Pundit
skip_before_action :force_sign_in_parity, raise: false
after_action :verify_authorized

before_action :authenticate_editor!
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/api/activity_stream_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

module Api
class ActivityStreamController < ApplicationController
skip_before_action :force_sign_in_parity, raise: false

def index
redirect_to(action: :enquiries, params: params)
end
Expand Down
1 change: 0 additions & 1 deletion app/controllers/api/document_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module Api
class DocumentController < ApplicationController
skip_before_action :verify_authenticity_token, raise: false
skip_before_action :force_sign_in_parity, raise: false

def index
params[:id].to_i
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/api/profile_dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ class ProfileDashboardController < ApplicationController
include RegionHelper
protect_from_forgery with: :exception

skip_before_action :force_sign_in_parity, raise: false

def index
hashed_sso_id = params[:hashed_sso_id] || params[:sso_user_id]
return bad_request! unless hashed_sso_id && params[:shared_secret]
Expand Down
6 changes: 0 additions & 6 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,12 @@ def determine_layout
# This method checks and signs them into ExOps if needed
before_action :force_sign_in_parity
def force_sign_in_parity
sign_out current_user unless cookies[sso_session_cookie]
return if current_user
return if (sso_id = cookies[sso_session_cookie]).blank?

if (sso_user = DirectoryApiClient.user_data(sso_id)).present?
if (user = User.find_by(email: sso_user['email'])).present?
sign_in user
elsif Figaro.env.magna_header_enabled?
auth_hash = { info: { email: sso_user['email'] }, provider: 'magna', uid: sso_user['id'] }
auth = JSON.parse(auth_hash.to_json, object_class: OpenStruct)
user = User.from_omniauth(auth)
sign_in user
end
else
cookies.delete sso_session_cookie
Expand Down
1 change: 0 additions & 1 deletion app/controllers/v1/base_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class V1::BaseController < ApplicationController
skip_before_action :authenticate_editor!, raise: false
skip_before_action :force_sign_in_parity, raise: false
protect_from_forgery with: :null_session

rescue_from ActiveRecord::RecordNotFound, with: :not_found
Expand Down

0 comments on commit 77cca42

Please sign in to comment.