Skip to content

Commit

Permalink
Move authentication into a controller concern
Browse files Browse the repository at this point in the history
  • Loading branch information
csutter committed Jan 23, 2025
1 parent df1dd5f commit add2f90
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception

include GDS::SSO::ControllerMethods
before_action :authenticate_user!
include Authentication
end
10 changes: 10 additions & 0 deletions app/controllers/concerns/authentication.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Requires a user to be logged in through GDS SSO for any action.
module Authentication
extend ActiveSupport::Concern

included do
include GDS::SSO::ControllerMethods

before_action :authenticate_user!
end
end

0 comments on commit add2f90

Please sign in to comment.