Skip to content

Commit

Permalink
Merge pull request #1484 from alphagov/basic-auth
Browse files Browse the repository at this point in the history
Add basic auth to government frontend review app
  • Loading branch information
sihugh authored Sep 13, 2019
2 parents 38dc142 + c1a66bc commit d3fc322
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@
},
"HEROKU_APP_NAME": {
"required": true
}
},
"BASIC_AUTH_USERNAME": {
"required": true
},
"BASIC_AUTH_PASSWORD": {
"required": true
},
"REQUIRE_BASIC_AUTH": "true"
},
"image": "heroku/ruby",
"buildpacks": [
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery except: :service_sign_in_options


if ENV["BASIC_AUTH_USERNAME"]
http_basic_authenticate_with(
name: ENV.fetch("BASIC_AUTH_USERNAME"),
password: ENV.fetch("BASIC_AUTH_PASSWORD")
)
end

private

def content_item_path
Expand Down

0 comments on commit d3fc322

Please sign in to comment.