simple_auth 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -1
- data/Gemfile.lock +84 -70
- data/lib/simple_auth.rb +4 -0
- data/lib/simple_auth/config.rb +1 -1
- data/lib/simple_auth/version.rb +1 -1
- data/simple_auth.gemspec +1 -1
- data/spec/simple_auth/session_spec.rb +6 -0
- data/spec/spec_helper.rb +6 -2
- metadata +71 -72
data/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--color --format documentation
|
1
|
+
--color --format documentation
|
data/Gemfile.lock
CHANGED
@@ -1,92 +1,100 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simple_auth (1.4.
|
4
|
+
simple_auth (1.4.1)
|
5
5
|
rails (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://gems.simplesideias.com.br/
|
9
9
|
specs:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
rack (~> 1.
|
21
|
-
rack-mount (~> 0.
|
22
|
-
rack-test (~> 0.
|
23
|
-
|
24
|
-
activemodel (3.0
|
25
|
-
activesupport (= 3.0
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
10
|
+
actionmailer (3.1.0)
|
11
|
+
actionpack (= 3.1.0)
|
12
|
+
mail (~> 2.3.0)
|
13
|
+
actionpack (3.1.0)
|
14
|
+
activemodel (= 3.1.0)
|
15
|
+
activesupport (= 3.1.0)
|
16
|
+
builder (~> 3.0.0)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
i18n (~> 0.6)
|
19
|
+
rack (~> 1.3.2)
|
20
|
+
rack-cache (~> 1.0.3)
|
21
|
+
rack-mount (~> 0.8.2)
|
22
|
+
rack-test (~> 0.6.1)
|
23
|
+
sprockets (~> 2.0.0)
|
24
|
+
activemodel (3.1.0)
|
25
|
+
activesupport (= 3.1.0)
|
26
|
+
bcrypt-ruby (~> 3.0.0)
|
27
|
+
builder (~> 3.0.0)
|
28
|
+
i18n (~> 0.6)
|
29
|
+
activerecord (3.1.0)
|
30
|
+
activemodel (= 3.1.0)
|
31
|
+
activesupport (= 3.1.0)
|
32
|
+
arel (~> 2.2.1)
|
33
|
+
tzinfo (~> 0.3.29)
|
34
|
+
activeresource (3.1.0)
|
35
|
+
activemodel (= 3.1.0)
|
36
|
+
activesupport (= 3.1.0)
|
37
|
+
activesupport (3.1.0)
|
38
|
+
multi_json (~> 1.0)
|
37
39
|
archive-tar-minitar (0.5.2)
|
38
|
-
arel (2.
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
activesupport (>= 2.3.4)
|
40
|
+
arel (2.2.1)
|
41
|
+
bcrypt-ruby (3.0.0)
|
42
|
+
bson (1.3.1)
|
43
|
+
bson_ext (1.3.1)
|
44
|
+
builder (3.0.0)
|
45
|
+
columnize (0.3.4)
|
46
|
+
diff-lcs (1.1.3)
|
47
|
+
erubis (2.7.0)
|
48
|
+
hike (1.2.1)
|
49
|
+
i18n (0.6.0)
|
49
50
|
linecache19 (0.5.12)
|
50
51
|
ruby_core_source (>= 0.1.4)
|
51
|
-
mail (2.
|
52
|
-
activesupport (>= 2.3.6)
|
52
|
+
mail (2.3.0)
|
53
53
|
i18n (>= 0.4.0)
|
54
54
|
mime-types (~> 1.16)
|
55
55
|
treetop (~> 1.4.8)
|
56
56
|
mime-types (1.16)
|
57
|
-
mongo (1.3.
|
58
|
-
bson (>= 1.3.
|
59
|
-
mongo_mapper (0.
|
60
|
-
|
61
|
-
|
62
|
-
plucky (~> 0.3.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
rack
|
57
|
+
mongo (1.3.1)
|
58
|
+
bson (>= 1.3.1)
|
59
|
+
mongo_mapper (0.9.1)
|
60
|
+
activemodel (~> 3.0)
|
61
|
+
activesupport (~> 3.0)
|
62
|
+
plucky (~> 0.3.8)
|
63
|
+
multi_json (1.0.3)
|
64
|
+
plucky (0.3.8)
|
65
|
+
mongo (~> 1.3)
|
66
|
+
polyglot (0.3.2)
|
67
|
+
rack (1.3.2)
|
68
|
+
rack-cache (1.0.3)
|
69
|
+
rack (>= 0.4)
|
70
|
+
rack-mount (0.8.3)
|
68
71
|
rack (>= 1.0.0)
|
69
|
-
rack-
|
72
|
+
rack-ssl (1.3.2)
|
73
|
+
rack
|
74
|
+
rack-test (0.6.1)
|
70
75
|
rack (>= 1.0)
|
71
|
-
rails (3.0
|
72
|
-
actionmailer (= 3.0
|
73
|
-
actionpack (= 3.0
|
74
|
-
activerecord (= 3.0
|
75
|
-
activeresource (= 3.0
|
76
|
-
activesupport (= 3.0
|
76
|
+
rails (3.1.0)
|
77
|
+
actionmailer (= 3.1.0)
|
78
|
+
actionpack (= 3.1.0)
|
79
|
+
activerecord (= 3.1.0)
|
80
|
+
activeresource (= 3.1.0)
|
81
|
+
activesupport (= 3.1.0)
|
77
82
|
bundler (~> 1.0)
|
78
|
-
railties (= 3.0
|
79
|
-
railties (3.0
|
80
|
-
actionpack (= 3.0
|
81
|
-
activesupport (= 3.0
|
83
|
+
railties (= 3.1.0)
|
84
|
+
railties (3.1.0)
|
85
|
+
actionpack (= 3.1.0)
|
86
|
+
activesupport (= 3.1.0)
|
87
|
+
rack-ssl (~> 1.3.2)
|
82
88
|
rake (>= 0.8.7)
|
83
|
-
|
84
|
-
|
89
|
+
rdoc (~> 3.4)
|
90
|
+
thor (~> 0.14.6)
|
91
|
+
rake (0.9.2)
|
92
|
+
rdoc (3.9.4)
|
85
93
|
rspec (2.5.0)
|
86
94
|
rspec-core (~> 2.5.0)
|
87
95
|
rspec-expectations (~> 2.5.0)
|
88
96
|
rspec-mocks (~> 2.5.0)
|
89
|
-
rspec-core (2.5.
|
97
|
+
rspec-core (2.5.2)
|
90
98
|
rspec-expectations (2.5.0)
|
91
99
|
diff-lcs (~> 1.1.2)
|
92
100
|
rspec-mocks (2.5.0)
|
@@ -105,20 +113,26 @@ GEM
|
|
105
113
|
ruby-debug-base19 (>= 0.11.19)
|
106
114
|
ruby_core_source (0.1.5)
|
107
115
|
archive-tar-minitar (>= 0.5.2)
|
108
|
-
|
116
|
+
sprockets (2.0.0)
|
117
|
+
hike (~> 1.2)
|
118
|
+
rack (~> 1.0)
|
119
|
+
tilt (!= 1.3.0, ~> 1.1)
|
120
|
+
sqlite3 (1.3.4)
|
109
121
|
sqlite3-ruby (1.3.3)
|
110
122
|
sqlite3 (>= 1.3.3)
|
111
123
|
thor (0.14.6)
|
112
|
-
|
124
|
+
tilt (1.3.3)
|
125
|
+
treetop (1.4.10)
|
126
|
+
polyglot
|
113
127
|
polyglot (>= 0.3.1)
|
114
|
-
tzinfo (0.3.
|
128
|
+
tzinfo (0.3.29)
|
115
129
|
|
116
130
|
PLATFORMS
|
117
131
|
ruby
|
118
132
|
|
119
133
|
DEPENDENCIES
|
120
134
|
bson_ext
|
121
|
-
mongo_mapper (~> 0.
|
135
|
+
mongo_mapper (~> 0.9.1)
|
122
136
|
rspec-rails (~> 2.5.0)
|
123
137
|
ruby-debug19
|
124
138
|
simple_auth!
|
data/lib/simple_auth.rb
CHANGED
data/lib/simple_auth/config.rb
CHANGED
@@ -27,7 +27,7 @@ module SimpleAuth
|
|
27
27
|
# the ActiveRecord instance as block parameter.
|
28
28
|
cattr_accessor :salt
|
29
29
|
@@salt = proc do |record|
|
30
|
-
Digest::SHA256.hexdigest [Time.to_s,
|
30
|
+
Digest::SHA256.hexdigest [Time.to_s, SecureRandom.hex(32)].join("--")
|
31
31
|
end
|
32
32
|
|
33
33
|
# Set which attributes will be used for authentication.
|
data/lib/simple_auth/version.rb
CHANGED
data/simple_auth.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency "rails", ">= 3.0.0"
|
21
21
|
s.add_development_dependency "sqlite3-ruby"
|
22
22
|
s.add_development_dependency "rspec-rails", "~> 2.5.0"
|
23
|
-
s.add_development_dependency "mongo_mapper", "~> 0.
|
23
|
+
s.add_development_dependency "mongo_mapper", "~> 0.9.1"
|
24
24
|
s.add_development_dependency "bson_ext"
|
25
25
|
s.add_development_dependency "ruby-debug19"
|
26
26
|
end
|
@@ -169,6 +169,12 @@ describe SimpleAuth::Session do
|
|
169
169
|
@user_session.save!
|
170
170
|
end
|
171
171
|
|
172
|
+
it "should keep return to url" do
|
173
|
+
@session[:return_to] = "/some/path"
|
174
|
+
@user_session.destroy
|
175
|
+
@session[:return_to].should == "/some/path"
|
176
|
+
end
|
177
|
+
|
172
178
|
it "should remove record session" do
|
173
179
|
@user_session.destroy
|
174
180
|
@session.should_not have_key(:user_id)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
ENV["RAILS_ENV"] = "test"
|
2
|
+
require "bundler"
|
3
|
+
Bundler.setup(:default, :development, :test)
|
4
|
+
Bundler.require
|
5
|
+
|
6
|
+
I18n.load_path += Dir[File.expand_path("../../locales/*.yml", __FILE__)]
|
7
|
+
|
2
8
|
require "rails"
|
3
9
|
require "simple_auth"
|
4
10
|
require File.dirname(__FILE__) + "/support/config/boot"
|
@@ -12,8 +18,6 @@ load File.dirname(__FILE__) + "/schema.rb"
|
|
12
18
|
MongoMapper.connection = Mongo::Connection.new("localhost")
|
13
19
|
MongoMapper.database = "simple_auth"
|
14
20
|
|
15
|
-
I18n.load_path += Dir[File.dirname(__FILE__) + "/../locales/*.yml"]
|
16
|
-
|
17
21
|
# Restore default configuration
|
18
22
|
RSpec.configure do |config|
|
19
23
|
config.before :each do
|
metadata
CHANGED
@@ -1,93 +1,89 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_auth
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.4.1
|
4
5
|
prerelease:
|
5
|
-
version: 1.4.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Nando Vieira
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-31 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: rails
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70122397445800 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
23
21
|
version: 3.0.0
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: sqlite3-ruby
|
28
23
|
prerelease: false
|
29
|
-
|
24
|
+
version_requirements: *70122397445800
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: sqlite3-ruby
|
27
|
+
requirement: &70122397438460 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
35
33
|
type: :development
|
36
|
-
version_requirements: *id002
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: rspec-rails
|
39
34
|
prerelease: false
|
40
|
-
|
35
|
+
version_requirements: *70122397438460
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec-rails
|
38
|
+
requirement: &70122397437180 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
40
|
+
requirements:
|
43
41
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
42
|
+
- !ruby/object:Gem::Version
|
45
43
|
version: 2.5.0
|
46
44
|
type: :development
|
47
|
-
version_requirements: *id003
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: mongo_mapper
|
50
45
|
prerelease: false
|
51
|
-
|
46
|
+
version_requirements: *70122397437180
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: mongo_mapper
|
49
|
+
requirement: &70122397436140 !ruby/object:Gem::Requirement
|
52
50
|
none: false
|
53
|
-
requirements:
|
51
|
+
requirements:
|
54
52
|
- - ~>
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.9.1
|
57
55
|
type: :development
|
58
|
-
version_requirements: *id004
|
59
|
-
- !ruby/object:Gem::Dependency
|
60
|
-
name: bson_ext
|
61
56
|
prerelease: false
|
62
|
-
|
57
|
+
version_requirements: *70122397436140
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: bson_ext
|
60
|
+
requirement: &70122397433940 !ruby/object:Gem::Requirement
|
63
61
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version:
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
68
66
|
type: :development
|
69
|
-
version_requirements: *id005
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: ruby-debug19
|
72
67
|
prerelease: false
|
73
|
-
|
68
|
+
version_requirements: *70122397433940
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ruby-debug19
|
71
|
+
requirement: &70122397413660 !ruby/object:Gem::Requirement
|
74
72
|
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version:
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
79
77
|
type: :development
|
80
|
-
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70122397413660
|
81
80
|
description: A simple authentication system for Rails apps
|
82
|
-
email:
|
81
|
+
email:
|
83
82
|
- fnando.vieira@gmail.com
|
84
83
|
executables: []
|
85
|
-
|
86
84
|
extensions: []
|
87
|
-
|
88
85
|
extra_rdoc_files: []
|
89
|
-
|
90
|
-
files:
|
86
|
+
files:
|
91
87
|
- .gitignore
|
92
88
|
- .rspec
|
93
89
|
- Gemfile
|
@@ -129,32 +125,35 @@ files:
|
|
129
125
|
- templates/initializer.rb
|
130
126
|
homepage: http://rubygems.org/gems/simple_auth
|
131
127
|
licenses: []
|
132
|
-
|
133
128
|
post_install_message:
|
134
129
|
rdoc_options: []
|
135
|
-
|
136
|
-
require_paths:
|
130
|
+
require_paths:
|
137
131
|
- lib
|
138
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
133
|
none: false
|
140
|
-
requirements:
|
141
|
-
- -
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
version:
|
144
|
-
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
segments:
|
139
|
+
- 0
|
140
|
+
hash: -4398059945838057970
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
142
|
none: false
|
146
|
-
requirements:
|
147
|
-
- -
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version:
|
143
|
+
requirements:
|
144
|
+
- - ! '>='
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
segments:
|
148
|
+
- 0
|
149
|
+
hash: -4398059945838057970
|
150
150
|
requirements: []
|
151
|
-
|
152
151
|
rubyforge_project:
|
153
|
-
rubygems_version: 1.8.
|
152
|
+
rubygems_version: 1.8.10
|
154
153
|
signing_key:
|
155
154
|
specification_version: 3
|
156
155
|
summary: A simple authentication system for Rails apps
|
157
|
-
test_files:
|
156
|
+
test_files:
|
158
157
|
- spec/controllers/redirect_logged_user_spec.rb
|
159
158
|
- spec/controllers/require_logged_user_spec.rb
|
160
159
|
- spec/schema.rb
|