simple_auth 1.4.5 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b9ccc966be8f5d91ed83365e91fd161dd3855411
4
+ data.tar.gz: ddeab7fa3b0cf45404e19a06f1b8ac0860ae39e4
5
+ SHA512:
6
+ metadata.gz: df425ff3d123c56b312517437615d925a979eb15b001061b6b304fbfcfe2e99594486365de3dff1e45cff6138f7a7543fe1cc8b9c1f837c672bf008131df5327
7
+ data.tar.gz: c1a2c7e841bfd56dd870fbddc96d6045df8cb6ed6eb4cf53ffd8c1ee53160159ff3ad202d7b361ab4bf4b25bd70f3fccc28bec444822d3b6cef1d9ad92c23165
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
- source :rubygems
1
+ source "http://rubygems.org"
2
2
  gemspec
3
+
4
+ gem "mongo_mapper", github: "jnunemaker/mongomapper"
data/Gemfile.lock CHANGED
@@ -1,122 +1,122 @@
1
+ GIT
2
+ remote: git://github.com/jnunemaker/mongomapper.git
3
+ revision: e0d7db141b2c330eb44773ef00d1b179bbdf9209
4
+ specs:
5
+ mongo_mapper (0.13.0.beta1)
6
+ activemodel (>= 3.0.0)
7
+ activesupport (>= 3.0)
8
+ mongo (~> 1.8)
9
+ plucky (~> 0.6.5)
10
+
1
11
  PATH
2
12
  remote: .
3
13
  specs:
4
- simple_auth (1.4.5)
14
+ simple_auth (1.5.0)
5
15
 
6
16
  GEM
7
17
  remote: http://rubygems.org/
8
18
  specs:
9
- actionmailer (3.2.12)
10
- actionpack (= 3.2.12)
11
- mail (~> 2.4.4)
12
- actionpack (3.2.12)
13
- activemodel (= 3.2.12)
14
- activesupport (= 3.2.12)
15
- builder (~> 3.0.0)
19
+ actionmailer (4.0.0)
20
+ actionpack (= 4.0.0)
21
+ mail (~> 2.5.3)
22
+ actionpack (4.0.0)
23
+ activesupport (= 4.0.0)
24
+ builder (~> 3.1.0)
16
25
  erubis (~> 2.7.0)
17
- journey (~> 1.0.4)
18
- rack (~> 1.4.5)
19
- rack-cache (~> 1.2)
20
- rack-test (~> 0.6.1)
21
- sprockets (~> 2.2.1)
22
- activemodel (3.2.12)
23
- activesupport (= 3.2.12)
24
- builder (~> 3.0.0)
25
- activerecord (3.2.12)
26
- activemodel (= 3.2.12)
27
- activesupport (= 3.2.12)
28
- arel (~> 3.0.2)
29
- tzinfo (~> 0.3.29)
30
- activeresource (3.2.12)
31
- activemodel (= 3.2.12)
32
- activesupport (= 3.2.12)
33
- activesupport (3.2.12)
34
- i18n (~> 0.6)
35
- multi_json (~> 1.0)
36
- arel (3.0.2)
37
- bson (1.8.2)
38
- bson_ext (1.8.2)
39
- bson (~> 1.8.2)
40
- builder (3.0.4)
41
- diff-lcs (1.1.3)
26
+ rack (~> 1.5.2)
27
+ rack-test (~> 0.6.2)
28
+ activemodel (4.0.0)
29
+ activesupport (= 4.0.0)
30
+ builder (~> 3.1.0)
31
+ activerecord (4.0.0)
32
+ activemodel (= 4.0.0)
33
+ activerecord-deprecated_finders (~> 1.0.2)
34
+ activesupport (= 4.0.0)
35
+ arel (~> 4.0.0)
36
+ activerecord-deprecated_finders (1.0.3)
37
+ activesupport (4.0.0)
38
+ i18n (~> 0.6, >= 0.6.4)
39
+ minitest (~> 4.2)
40
+ multi_json (~> 1.3)
41
+ thread_safe (~> 0.1)
42
+ tzinfo (~> 0.3.37)
43
+ arel (4.0.0)
44
+ atomic (1.1.12)
45
+ bson (1.9.1)
46
+ bson_ext (1.9.1)
47
+ bson (~> 1.9.1)
48
+ builder (3.1.4)
49
+ diff-lcs (1.2.4)
42
50
  erubis (2.7.0)
43
- hike (1.2.1)
44
- i18n (0.6.1)
45
- journey (1.0.4)
46
- json (1.7.7)
47
- mail (2.4.4)
48
- i18n (>= 0.4.0)
51
+ hike (1.2.3)
52
+ i18n (0.6.4)
53
+ mail (2.5.4)
49
54
  mime-types (~> 1.16)
50
55
  treetop (~> 1.4.8)
51
- mime-types (1.21)
52
- mongo (1.8.2)
53
- bson (~> 1.8.2)
54
- mongo_mapper (0.9.2)
55
- activemodel (~> 3.0)
56
- activesupport (~> 3.0)
57
- plucky (~> 0.3.8)
58
- multi_json (1.6.0)
59
- plucky (0.3.8)
60
- mongo (~> 1.3)
56
+ mime-types (1.23)
57
+ minitest (4.7.5)
58
+ mongo (1.9.1)
59
+ bson (~> 1.9.1)
60
+ multi_json (1.7.7)
61
+ plucky (0.6.5)
62
+ mongo (~> 1.5)
61
63
  polyglot (0.3.3)
62
- rack (1.4.5)
63
- rack-cache (1.2)
64
- rack (>= 0.4)
65
- rack-ssl (1.3.3)
66
- rack
64
+ rack (1.5.2)
67
65
  rack-test (0.6.2)
68
66
  rack (>= 1.0)
69
- rails (3.2.12)
70
- actionmailer (= 3.2.12)
71
- actionpack (= 3.2.12)
72
- activerecord (= 3.2.12)
73
- activeresource (= 3.2.12)
74
- activesupport (= 3.2.12)
75
- bundler (~> 1.0)
76
- railties (= 3.2.12)
77
- railties (3.2.12)
78
- actionpack (= 3.2.12)
79
- activesupport (= 3.2.12)
80
- rack-ssl (~> 1.3.2)
67
+ rails (4.0.0)
68
+ actionmailer (= 4.0.0)
69
+ actionpack (= 4.0.0)
70
+ activerecord (= 4.0.0)
71
+ activesupport (= 4.0.0)
72
+ bundler (>= 1.3.0, < 2.0)
73
+ railties (= 4.0.0)
74
+ sprockets-rails (~> 2.0.0)
75
+ railties (4.0.0)
76
+ actionpack (= 4.0.0)
77
+ activesupport (= 4.0.0)
81
78
  rake (>= 0.8.7)
82
- rdoc (~> 3.4)
83
- thor (>= 0.14.6, < 2.0)
84
- rake (10.0.3)
85
- rdoc (3.12.1)
86
- json (~> 1.4)
87
- rspec-core (2.12.2)
88
- rspec-expectations (2.12.1)
89
- diff-lcs (~> 1.1.3)
90
- rspec-mocks (2.12.2)
91
- rspec-rails (2.12.2)
79
+ thor (>= 0.18.1, < 2.0)
80
+ rake (10.1.0)
81
+ rspec-core (2.14.4)
82
+ rspec-expectations (2.14.0)
83
+ diff-lcs (>= 1.1.3, < 2.0)
84
+ rspec-mocks (2.14.2)
85
+ rspec-rails (2.14.0)
92
86
  actionpack (>= 3.0)
93
87
  activesupport (>= 3.0)
94
88
  railties (>= 3.0)
95
- rspec-core (~> 2.12.0)
96
- rspec-expectations (~> 2.12.0)
97
- rspec-mocks (~> 2.12.0)
98
- sprockets (2.2.2)
89
+ rspec-core (~> 2.14.0)
90
+ rspec-expectations (~> 2.14.0)
91
+ rspec-mocks (~> 2.14.0)
92
+ sprockets (2.10.0)
99
93
  hike (~> 1.2)
100
94
  multi_json (~> 1.0)
101
95
  rack (~> 1.0)
102
96
  tilt (~> 1.1, != 1.3.0)
97
+ sprockets-rails (2.0.0)
98
+ actionpack (>= 3.0)
99
+ activesupport (>= 3.0)
100
+ sprockets (~> 2.8)
103
101
  sqlite3 (1.3.7)
104
102
  sqlite3-ruby (1.3.3)
105
103
  sqlite3 (>= 1.3.3)
106
- thor (0.17.0)
107
- tilt (1.3.3)
108
- treetop (1.4.12)
104
+ thor (0.18.1)
105
+ thread_safe (0.1.2)
106
+ atomic
107
+ tilt (1.4.1)
108
+ treetop (1.4.14)
109
109
  polyglot
110
110
  polyglot (>= 0.3.1)
111
- tzinfo (0.3.35)
111
+ tzinfo (0.3.37)
112
112
 
113
113
  PLATFORMS
114
114
  ruby
115
115
 
116
116
  DEPENDENCIES
117
117
  bson_ext
118
- mongo_mapper (~> 0.9.1)
119
- rails
120
- rspec-rails (~> 2.5)
118
+ mongo_mapper!
119
+ rails (>= 4.0.0)
120
+ rspec-rails
121
121
  simple_auth!
122
122
  sqlite3-ruby
@@ -52,21 +52,16 @@ module SimpleAuth
52
52
  # User.find_by_credential "john" # using username
53
53
  #
54
54
  def find_by_credential(credential)
55
- # Build a hash that will be passed to the finder
56
- options = {:conditions => [[], {}]}
55
+ # Collect each attribute that should be used as credential.
56
+ query = SimpleAuth::Config.credentials.each_with_object([]) do |attr_name, buffer|
57
+ buffer << "#{attr_name} = :credential"
58
+ end.join(" or ")
57
59
 
58
- # Iterate each attribute that should be used as credential
59
- # and set it to the finder conditions hash
60
- SimpleAuth::Config.credentials.each do |attr_name|
61
- options[:conditions][0] << "#{attr_name} = :#{attr_name}"
62
- options[:conditions][1][attr_name] = credential
63
- end
64
-
65
- # Join the attributes in OR query
66
- options[:conditions][0] = options[:conditions][0].join(" OR ")
60
+ # Set the scope.
61
+ scope = SimpleAuth::Config.model_class.where(query, credential: credential.to_s)
67
62
 
68
63
  # Find the record using the conditions we built
69
- SimpleAuth::Config.model_class.first(options)
64
+ scope.first
70
65
  end
71
66
 
72
67
  # Find user by its credential. If no user is found, raise
@@ -1,8 +1,8 @@
1
1
  module SimpleAuth
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 4
5
- PATCH = 5
4
+ MINOR = 5
5
+ PATCH = 0
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
data/simple_auth.gemspec CHANGED
@@ -1,6 +1,4 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "simple_auth/version"
1
+ require "./lib/simple_auth/version"
4
2
 
5
3
  Gem::Specification.new do |s|
6
4
  s.name = "simple_auth"
@@ -17,9 +15,9 @@ Gem::Specification.new do |s|
17
15
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
16
  s.require_paths = ["lib"]
19
17
 
20
- s.add_development_dependency "rails"
18
+ s.add_development_dependency "rails", ">= 4.0.0"
21
19
  s.add_development_dependency "sqlite3-ruby"
22
- s.add_development_dependency "rspec-rails", "~> 2.5"
23
- s.add_development_dependency "mongo_mapper", "~> 0.9.1"
20
+ s.add_development_dependency "rspec-rails"
21
+ s.add_development_dependency "mongo_mapper"
24
22
  s.add_development_dependency "bson_ext"
25
23
  end
@@ -8,6 +8,8 @@ module SimpleAuth
8
8
  class Application < Rails::Application
9
9
  config.root = File.dirname(__FILE__) + "/.."
10
10
  config.active_support.deprecation = :log
11
+ config.secret_key_base = "secret"
12
+ config.eager_load = false
11
13
  end
12
14
  end
13
15
 
metadata CHANGED
@@ -1,94 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
5
- prerelease:
4
+ version: 1.5.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nando Vieira
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-13 00:00:00.000000000 Z
11
+ date: 2013-08-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: 4.0.0
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
- version: '0'
26
+ version: 4.0.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: sqlite3-ruby
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec-rails
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
- version: '2.5'
47
+ version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
- version: '2.5'
54
+ version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: mongo_mapper
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
- version: 0.9.1
61
+ version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
- version: 0.9.1
68
+ version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: bson_ext
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  description: A simple authentication system for Rails apps
@@ -141,26 +130,25 @@ files:
141
130
  - templates/initializer.rb
142
131
  homepage: http://rubygems.org/gems/simple_auth
143
132
  licenses: []
133
+ metadata: {}
144
134
  post_install_message:
145
135
  rdoc_options: []
146
136
  require_paths:
147
137
  - lib
148
138
  required_ruby_version: !ruby/object:Gem::Requirement
149
- none: false
150
139
  requirements:
151
- - - ! '>='
140
+ - - '>='
152
141
  - !ruby/object:Gem::Version
153
142
  version: '0'
154
143
  required_rubygems_version: !ruby/object:Gem::Requirement
155
- none: false
156
144
  requirements:
157
- - - ! '>='
145
+ - - '>='
158
146
  - !ruby/object:Gem::Version
159
147
  version: '0'
160
148
  requirements: []
161
149
  rubyforge_project:
162
- rubygems_version: 1.8.25
150
+ rubygems_version: 2.0.3
163
151
  signing_key:
164
- specification_version: 3
152
+ specification_version: 4
165
153
  summary: A simple authentication system for Rails apps
166
154
  test_files: []