Skip to content
This repository has been archived by the owner on Oct 12, 2018. It is now read-only.

Commit

Permalink
Merge branch 'require_signin_permission'
Browse files Browse the repository at this point in the history
Conflicts:
	Gemfile.lock
  • Loading branch information
jamiecobbett committed Jul 9, 2012
2 parents c7e7a40 + 469f98c commit be36645
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ end
if ENV['BUNDLE_DEV']
gem 'gds-sso', path: '../gds-sso'
else
gem 'gds-sso', '0.7.0'
gem 'gds-sso', '0.7.9'
end

group :assets do
Expand Down
17 changes: 10 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,14 @@ GEM
factory_girl_rails (3.3.0)
factory_girl (~> 3.3.0)
railties (>= 3.0.0)
fakeweb (1.3.0)
faraday (0.8.1)
multipart-post (~> 1.1)
ffi (1.0.11)
gds-api-adapters (0.0.50)
lrucache (~> 0.1.1)
null_logger
plek
gds-sso (0.7.0)
gds-sso (0.7.9)
omniauth-gds (= 0.0.3)
rack-accept (~> 0.4.4)
rails (>= 3.0.0)
Expand All @@ -133,6 +132,8 @@ GEM
httpauth (0.1)
i18n (0.6.0)
json (1.7.3)
jwt (0.1.4)
json (>= 1.2.4)
launchy (2.0.5)
addressable (~> 2.2.6)
libv8 (3.3.10.4)
Expand Down Expand Up @@ -164,17 +165,19 @@ GEM
net-http-persistent (1.9)
nokogiri (1.5.0)
null_logger (0.0.1)
oauth2 (0.6.0)
faraday (~> 0.7)
oauth2 (0.8.0)
faraday (~> 0.8)
httpauth (~> 0.1)
jwt (~> 0.1.4)
multi_json (~> 1.0)
rack (~> 1.2)
omniauth (1.1.0)
hashie (~> 1.2)
rack
omniauth-gds (0.0.3)
omniauth-oauth2 (~> 1.0)
omniauth-oauth2 (1.0.2)
oauth2 (~> 0.6.0)
omniauth-oauth2 (1.1.0)
oauth2 (~> 0.8.0)
omniauth (~> 1.0)
plek (0.1.24)
builder
Expand Down Expand Up @@ -284,7 +287,7 @@ DEPENDENCIES
formtastic!
formtastic-bootstrap!
gds-api-adapters
gds-sso (= 0.7.0)
gds-sso (= 0.7.9)
gds-warmup-controller (= 0.1.0)
gelf
govuk_content_models (= 0.1.6)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ class ApplicationController < ActionController::Base
include GDS::SSO::ControllerMethods

before_filter :authenticate_user!
before_filter :require_signin_permission!

rescue_from Mongoid::Errors::DocumentNotFound, with: :record_not_found

Expand Down
1 change: 1 addition & 0 deletions config/initializers/gds-sso.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
config.user_model = "User"
config.oauth_id = 'abcdefgh12345678pan'
config.oauth_secret = 'secret'
config.default_scope = "Panopticon"
config.oauth_root_url = Plek.current.find("authentication")
config.basic_auth_user = 'api'
config.basic_auth_password = 'defined_on_rollout_not'
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/secret_token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Panopticon::Application.config.secret_token = '1c03c8a863ffef3dfd468a20bee651c98963b9d633a517ed73e46572e3ff0587fd968a74858327e17e529567be2ff2746a0ba571a1e6b54ce816afa70967427c'
Panopticon::Application.config.secret_token = 'o1c03c8a863ffef3dfd468a20bee651c98963b9d633a517ed73e46572e3ff0587fd968a74858327e17e529567be2ff2746a0ba571a1e6b54ce816afa70967427c'
2 changes: 1 addition & 1 deletion features/step_definitions/session_steps.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Given /^I am (?:a|an) (admin)$/ do |role|
user = User.create(:name => "user")
user = FactoryGirl.create(:user, :name => "user")
login_as user
end
2 changes: 1 addition & 1 deletion script/import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def build_params(hash, keys)
params = build_params(u, [
:name, :uid, :version, :email, :created_at, :updated_at
])
User.create!(params)
FactoryGirl.create(:user, params)
end

export["artefacts"].each do |a|
Expand Down
2 changes: 1 addition & 1 deletion test/integration/api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def startup_server
end

def create_test_user
User.create!(name: "Test", email: "test@example.com", uid: 123)
FactoryGirl.create(:user, name: "Test", email: "test@example.com", uid: 123)
end

test "Can create an artefact via the api" do
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def app
end

def login_as_stub_user
temp_user = User.create!(:name => 'Stub User')
temp_user = FactoryGirl.create(:user, :name => 'Stub User')
request.env['warden'] = stub(:authenticate! => true, :authenticated? => true, :user => temp_user)
end

Expand Down

0 comments on commit be36645

Please sign in to comment.