devise-remote-user 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/LICENSE +2 -2
- data/Rakefile +1 -1
- data/lib/devise_remote_user.rb +9 -1
- data/lib/devise_remote_user/controller_behavior.rb +1 -1
- data/lib/devise_remote_user/manager.rb +1 -1
- data/lib/devise_remote_user/strategy.rb +1 -1
- data/lib/devise_remote_user/version.rb +1 -1
- data/spec/dummy/config/environments/development.rb +1 -1
- data/spec/dummy/config/initializers/secret_token.rb +1 -1
- data/spec/dummy/db/schema.rb +10 -10
- data/spec/lib/devise_remote_user_spec.rb +26 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ea43fa1645bacbef76625f16da7ddb09df554f9
|
4
|
+
data.tar.gz: 3b45eb2d414829ad1e12a168132437e5085b0e57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ad42b730848ab59b73bfc1b26ae04c20f43109ca35550565a0f3bec067119310c38693c27e4bcea70dffdb54ec033c9bb67c31ef6dcba2a044d075cd7aff88d
|
7
|
+
data.tar.gz: 7b988dedda661d1056357674a25adf692025f5796bcdadbd8738239c43902c1b69b439ca90c74d96b7005f5d3f7e3d27f6356610578f6fee9b1a6f01d840c871
|
data/.travis.yml
ADDED
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) Duke University.
|
2
2
|
All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification,
|
@@ -11,7 +11,7 @@ are permitted provided that the following conditions are met:
|
|
11
11
|
list of conditions and the following disclaimer in the documentation and/or
|
12
12
|
other materials provided with the distribution.
|
13
13
|
|
14
|
-
Neither the name of
|
14
|
+
Neither the name of Duke University nor the names of its
|
15
15
|
contributors may be used to endorse or promote products derived from
|
16
16
|
this software without specific prior written permission.
|
17
17
|
|
data/Rakefile
CHANGED
@@ -15,6 +15,6 @@ require 'rspec/core'
|
|
15
15
|
require 'rspec/core/rake_task'
|
16
16
|
|
17
17
|
desc "Run all specs in spec directory (excluding plugin specs)"
|
18
|
-
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
|
18
|
+
RSpec::Core::RakeTask.new(:spec => ['app:db:migrate', 'app:db:test:prepare'])
|
19
19
|
|
20
20
|
task :default => :spec
|
data/lib/devise_remote_user.rb
CHANGED
@@ -35,6 +35,15 @@ module DeviseRemoteUser
|
|
35
35
|
def self.configure
|
36
36
|
yield self
|
37
37
|
end
|
38
|
+
|
39
|
+
def self.remote_user_id env
|
40
|
+
case env_key
|
41
|
+
when Proc
|
42
|
+
env_key.call(env)
|
43
|
+
else
|
44
|
+
env[env_key]
|
45
|
+
end
|
46
|
+
end
|
38
47
|
|
39
48
|
end
|
40
49
|
|
@@ -42,4 +51,3 @@ Devise.add_module(:remote_user_authenticatable,
|
|
42
51
|
:strategy => true,
|
43
52
|
:controller => :sessions,
|
44
53
|
:model => 'devise_remote_user/model')
|
45
|
-
|
@@ -20,7 +20,7 @@ Dummy::Application.configure do
|
|
20
20
|
config.active_support.deprecation = :log
|
21
21
|
|
22
22
|
# Raise an error on page load if there are pending migrations
|
23
|
-
config.active_record.migration_error = :page_load
|
23
|
+
#config.active_record.migration_error = :page_load
|
24
24
|
|
25
25
|
# Debug mode disables concatenation and preprocessing of assets.
|
26
26
|
# This option may cause significant delays in view rendering with a large
|
@@ -9,4 +9,4 @@
|
|
9
9
|
|
10
10
|
# Make sure your secret_key_base is kept private
|
11
11
|
# if you're sharing your code publicly.
|
12
|
-
Dummy::Application.config.
|
12
|
+
Dummy::Application.config.secret_token = 'd21fd8b56cd95305d2900f46c17cfecf9cfd198395a33c487af053c3c8e8cfc6bd1846dc9d40731f1d98ae9dd571d3d88be03af97cc46c5cf112b6c2e69f8fc2'
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -9,30 +9,30 @@
|
|
9
9
|
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
10
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
11
|
#
|
12
|
-
# It's strongly recommended
|
12
|
+
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version
|
14
|
+
ActiveRecord::Schema.define(:version => 20131101184256) do
|
15
15
|
|
16
|
-
create_table "users", force
|
17
|
-
t.string "email", default
|
18
|
-
t.string "encrypted_password", default
|
16
|
+
create_table "users", :force => true do |t|
|
17
|
+
t.string "email", :default => "", :null => false
|
18
|
+
t.string "encrypted_password", :default => "", :null => false
|
19
19
|
t.string "reset_password_token"
|
20
20
|
t.datetime "reset_password_sent_at"
|
21
21
|
t.datetime "remember_created_at"
|
22
|
-
t.integer "sign_in_count", default
|
22
|
+
t.integer "sign_in_count", :default => 0, :null => false
|
23
23
|
t.datetime "current_sign_in_at"
|
24
24
|
t.datetime "last_sign_in_at"
|
25
25
|
t.string "current_sign_in_ip"
|
26
26
|
t.string "last_sign_in_ip"
|
27
|
-
t.datetime "created_at"
|
28
|
-
t.datetime "updated_at"
|
27
|
+
t.datetime "created_at", :null => false
|
28
|
+
t.datetime "updated_at", :null => false
|
29
29
|
t.string "first_name"
|
30
30
|
t.string "last_name"
|
31
31
|
t.string "nickname"
|
32
32
|
t.string "display_name"
|
33
33
|
end
|
34
34
|
|
35
|
-
add_index "users", ["email"], name
|
36
|
-
add_index "users", ["reset_password_token"], name
|
35
|
+
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
36
|
+
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
37
37
|
|
38
38
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DeviseRemoteUser do
|
4
|
+
context ".remote_user_id" do
|
5
|
+
let(:mock_env) { { 'REMOTE_USER' => 'some-id' } }
|
6
|
+
context "with a string for the env_key" do
|
7
|
+
before do
|
8
|
+
DeviseRemoteUser.env_key = "REMOTE_USER"
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should retrieve the key from the env" do
|
12
|
+
expect(DeviseRemoteUser.remote_user_id(mock_env)).to eq "some-id"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "with a proc for the env_key" do
|
17
|
+
before do
|
18
|
+
DeviseRemoteUser.env_key = lambda { |env| "#{env['REMOTE_USER']}@example.com" }
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should retrieve the key from the env" do
|
22
|
+
expect(DeviseRemoteUser.remote_user_id(mock_env)).to eq "some-id@example.com"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise-remote-user
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chandek-Stark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -111,6 +111,7 @@ extra_rdoc_files:
|
|
111
111
|
files:
|
112
112
|
- .gitignore
|
113
113
|
- .rspec
|
114
|
+
- .travis.yml
|
114
115
|
- CONTRIBUTING.md
|
115
116
|
- Gemfile
|
116
117
|
- LICENSE
|
@@ -187,6 +188,7 @@ files:
|
|
187
188
|
- spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
188
189
|
- spec/factories/user_factories.rb
|
189
190
|
- spec/factories/user_factories.rb~
|
191
|
+
- spec/lib/devise_remote_user_spec.rb
|
190
192
|
- spec/spec_helper.rb
|
191
193
|
homepage: http://github.com/duke-libraries/devise-remote-user
|
192
194
|
licenses:
|
@@ -269,4 +271,5 @@ test_files:
|
|
269
271
|
- spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
270
272
|
- spec/factories/user_factories.rb
|
271
273
|
- spec/factories/user_factories.rb~
|
274
|
+
- spec/lib/devise_remote_user_spec.rb
|
272
275
|
- spec/spec_helper.rb
|