oath 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +3 -0
  5. data/Gemfile +3 -0
  6. data/Gemfile.lock +165 -0
  7. data/LICENSE.txt +22 -0
  8. data/NEWS.rdoc +118 -0
  9. data/README.md +384 -0
  10. data/Rakefile +6 -0
  11. data/lib/oath.rb +132 -0
  12. data/lib/oath/back_door.rb +53 -0
  13. data/lib/oath/configuration.rb +149 -0
  14. data/lib/oath/constraints/signed_in.rb +14 -0
  15. data/lib/oath/constraints/signed_out.rb +14 -0
  16. data/lib/oath/controller_helpers.rb +161 -0
  17. data/lib/oath/failure_app.rb +48 -0
  18. data/lib/oath/field_map.rb +56 -0
  19. data/lib/oath/param_transformer.rb +38 -0
  20. data/lib/oath/railtie.rb +11 -0
  21. data/lib/oath/services.rb +5 -0
  22. data/lib/oath/services/authentication.rb +40 -0
  23. data/lib/oath/services/password_reset.rb +27 -0
  24. data/lib/oath/services/sign_in.rb +25 -0
  25. data/lib/oath/services/sign_out.rb +24 -0
  26. data/lib/oath/services/sign_up.rb +42 -0
  27. data/lib/oath/strategies/password_strategy.rb +42 -0
  28. data/lib/oath/test/controller_helpers.rb +43 -0
  29. data/lib/oath/test/helpers.rb +24 -0
  30. data/lib/oath/version.rb +4 -0
  31. data/lib/oath/warden_setup.rb +47 -0
  32. data/oath.gemspec +30 -0
  33. data/spec/features/user/user_signs_in_spec.rb +14 -0
  34. data/spec/features/user/user_signs_in_through_back_door_spec.rb +11 -0
  35. data/spec/features/user/user_tries_to_access_constrained_routes_spec.rb +18 -0
  36. data/spec/features/user/user_tries_to_access_http_auth_page_spec.rb +9 -0
  37. data/spec/features/visitor/visitor_fails_to_sign_up_spec.rb +10 -0
  38. data/spec/features/visitor/visitor_is_unauthorized_spec.rb +8 -0
  39. data/spec/features/visitor/visitor_signs_in_via_invalid_form_spec.rb +11 -0
  40. data/spec/features/visitor/visitor_signs_up_spec.rb +40 -0
  41. data/spec/features/visitor/visitor_tries_to_access_constrained_routes_spec.rb +14 -0
  42. data/spec/features/visitor/visitor_uses_remember_token_spec.rb +13 -0
  43. data/spec/oath/configuration_spec.rb +11 -0
  44. data/spec/oath/controller_helpers_spec.rb +180 -0
  45. data/spec/oath/field_map_spec.rb +19 -0
  46. data/spec/oath/services/authentication_spec.rb +25 -0
  47. data/spec/oath/services/password_reset_spec.rb +24 -0
  48. data/spec/oath/services/sign_in_spec.rb +13 -0
  49. data/spec/oath/services/sign_out_spec.rb +13 -0
  50. data/spec/oath/services/sign_up_spec.rb +49 -0
  51. data/spec/oath/strategies/password_strategy_spec.rb +23 -0
  52. data/spec/oath/test_controller_helpers_spec.rb +63 -0
  53. data/spec/oath/test_helpers_spec.rb +97 -0
  54. data/spec/oath_spec.rb +27 -0
  55. data/spec/rails_app/Rakefile +7 -0
  56. data/spec/rails_app/app/assets/images/rails.png +0 -0
  57. data/spec/rails_app/app/assets/javascripts/application.js +13 -0
  58. data/spec/rails_app/app/assets/stylesheets/application.css +13 -0
  59. data/spec/rails_app/app/controllers/application_controller.rb +4 -0
  60. data/spec/rails_app/app/controllers/basic_auth_controller.rb +7 -0
  61. data/spec/rails_app/app/controllers/constrained_to_users_controller.rb +5 -0
  62. data/spec/rails_app/app/controllers/constrained_to_visitors_controller.rb +5 -0
  63. data/spec/rails_app/app/controllers/failures_controller.rb +5 -0
  64. data/spec/rails_app/app/controllers/invalid_sessions_controller.rb +2 -0
  65. data/spec/rails_app/app/controllers/posts_controller.rb +6 -0
  66. data/spec/rails_app/app/controllers/sessions_controller.rb +26 -0
  67. data/spec/rails_app/app/controllers/users_controller.rb +23 -0
  68. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  69. data/spec/rails_app/app/models/user.rb +10 -0
  70. data/spec/rails_app/app/views/invalid_sessions/new.html.erb +4 -0
  71. data/spec/rails_app/app/views/layouts/application.html.erb +18 -0
  72. data/spec/rails_app/app/views/posts/index.html.erb +1 -0
  73. data/spec/rails_app/app/views/sessions/new.html.erb +5 -0
  74. data/spec/rails_app/app/views/users/new.html.erb +5 -0
  75. data/spec/rails_app/config.ru +4 -0
  76. data/spec/rails_app/config/application.rb +58 -0
  77. data/spec/rails_app/config/boot.rb +6 -0
  78. data/spec/rails_app/config/database.yml +25 -0
  79. data/spec/rails_app/config/environment.rb +5 -0
  80. data/spec/rails_app/config/environments/development.rb +29 -0
  81. data/spec/rails_app/config/environments/production.rb +54 -0
  82. data/spec/rails_app/config/environments/test.rb +29 -0
  83. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  84. data/spec/rails_app/config/initializers/inflections.rb +15 -0
  85. data/spec/rails_app/config/initializers/secret_token.rb +7 -0
  86. data/spec/rails_app/config/routes.rb +24 -0
  87. data/spec/rails_app/db/seeds.rb +7 -0
  88. data/spec/rails_app/public/404.html +26 -0
  89. data/spec/rails_app/public/422.html +26 -0
  90. data/spec/rails_app/public/500.html +25 -0
  91. data/spec/rails_app/public/favicon.ico +0 -0
  92. data/spec/rails_app/script/rails +6 -0
  93. data/spec/spec_helper.rb +37 -0
  94. metadata +325 -0
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,37 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ $LOAD_PATH.unshift File.dirname(__FILE__)
3
+
4
+ require 'rails_app/config/environment'
5
+ require 'rspec/rails'
6
+ require 'warden'
7
+ require 'oath'
8
+ require 'capybara'
9
+
10
+ Oath.test_mode!
11
+ Warden.test_mode!
12
+
13
+ RSpec.configure do |config|
14
+ config.include Warden::Test::Helpers
15
+ config.include Oath::Test::Helpers, type: :feature
16
+ config.order = "random"
17
+ config.after :each do
18
+ Oath.test_reset!
19
+ end
20
+ end
21
+
22
+ def with_oath_config(hash, &block)
23
+ begin
24
+ old_config = {}
25
+ hash.each do |key, value|
26
+ old_config[key] = Oath.config.send(key)
27
+ Oath.config.send(:"#{key}=", value)
28
+ end
29
+
30
+ yield
31
+ ensure
32
+
33
+ old_config.each do |key, value|
34
+ Oath.config.send(:"#{key}=", old_config[key])
35
+ end
36
+ end
37
+ end
metadata ADDED
@@ -0,0 +1,325 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: oath
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - halogenandtoast
8
+ - calebthompson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-12-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: bcrypt
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: warden
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec-rails
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: capybara
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: sqlite3
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: active_hash
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ description: simple rails authentication
141
+ email:
142
+ - halogenandtoast@gmail.com
143
+ executables: []
144
+ extensions: []
145
+ extra_rdoc_files: []
146
+ files:
147
+ - ".gitignore"
148
+ - ".rspec"
149
+ - ".travis.yml"
150
+ - Gemfile
151
+ - Gemfile.lock
152
+ - LICENSE.txt
153
+ - NEWS.rdoc
154
+ - README.md
155
+ - Rakefile
156
+ - lib/oath.rb
157
+ - lib/oath/back_door.rb
158
+ - lib/oath/configuration.rb
159
+ - lib/oath/constraints/signed_in.rb
160
+ - lib/oath/constraints/signed_out.rb
161
+ - lib/oath/controller_helpers.rb
162
+ - lib/oath/failure_app.rb
163
+ - lib/oath/field_map.rb
164
+ - lib/oath/param_transformer.rb
165
+ - lib/oath/railtie.rb
166
+ - lib/oath/services.rb
167
+ - lib/oath/services/authentication.rb
168
+ - lib/oath/services/password_reset.rb
169
+ - lib/oath/services/sign_in.rb
170
+ - lib/oath/services/sign_out.rb
171
+ - lib/oath/services/sign_up.rb
172
+ - lib/oath/strategies/password_strategy.rb
173
+ - lib/oath/test/controller_helpers.rb
174
+ - lib/oath/test/helpers.rb
175
+ - lib/oath/version.rb
176
+ - lib/oath/warden_setup.rb
177
+ - oath.gemspec
178
+ - spec/features/user/user_signs_in_spec.rb
179
+ - spec/features/user/user_signs_in_through_back_door_spec.rb
180
+ - spec/features/user/user_tries_to_access_constrained_routes_spec.rb
181
+ - spec/features/user/user_tries_to_access_http_auth_page_spec.rb
182
+ - spec/features/visitor/visitor_fails_to_sign_up_spec.rb
183
+ - spec/features/visitor/visitor_is_unauthorized_spec.rb
184
+ - spec/features/visitor/visitor_signs_in_via_invalid_form_spec.rb
185
+ - spec/features/visitor/visitor_signs_up_spec.rb
186
+ - spec/features/visitor/visitor_tries_to_access_constrained_routes_spec.rb
187
+ - spec/features/visitor/visitor_uses_remember_token_spec.rb
188
+ - spec/oath/configuration_spec.rb
189
+ - spec/oath/controller_helpers_spec.rb
190
+ - spec/oath/field_map_spec.rb
191
+ - spec/oath/services/authentication_spec.rb
192
+ - spec/oath/services/password_reset_spec.rb
193
+ - spec/oath/services/sign_in_spec.rb
194
+ - spec/oath/services/sign_out_spec.rb
195
+ - spec/oath/services/sign_up_spec.rb
196
+ - spec/oath/strategies/password_strategy_spec.rb
197
+ - spec/oath/test_controller_helpers_spec.rb
198
+ - spec/oath/test_helpers_spec.rb
199
+ - spec/oath_spec.rb
200
+ - spec/rails_app/Rakefile
201
+ - spec/rails_app/app/assets/images/rails.png
202
+ - spec/rails_app/app/assets/javascripts/application.js
203
+ - spec/rails_app/app/assets/stylesheets/application.css
204
+ - spec/rails_app/app/controllers/application_controller.rb
205
+ - spec/rails_app/app/controllers/basic_auth_controller.rb
206
+ - spec/rails_app/app/controllers/constrained_to_users_controller.rb
207
+ - spec/rails_app/app/controllers/constrained_to_visitors_controller.rb
208
+ - spec/rails_app/app/controllers/failures_controller.rb
209
+ - spec/rails_app/app/controllers/invalid_sessions_controller.rb
210
+ - spec/rails_app/app/controllers/posts_controller.rb
211
+ - spec/rails_app/app/controllers/sessions_controller.rb
212
+ - spec/rails_app/app/controllers/users_controller.rb
213
+ - spec/rails_app/app/helpers/application_helper.rb
214
+ - spec/rails_app/app/models/user.rb
215
+ - spec/rails_app/app/views/invalid_sessions/new.html.erb
216
+ - spec/rails_app/app/views/layouts/application.html.erb
217
+ - spec/rails_app/app/views/posts/index.html.erb
218
+ - spec/rails_app/app/views/sessions/new.html.erb
219
+ - spec/rails_app/app/views/users/new.html.erb
220
+ - spec/rails_app/config.ru
221
+ - spec/rails_app/config/application.rb
222
+ - spec/rails_app/config/boot.rb
223
+ - spec/rails_app/config/database.yml
224
+ - spec/rails_app/config/environment.rb
225
+ - spec/rails_app/config/environments/development.rb
226
+ - spec/rails_app/config/environments/production.rb
227
+ - spec/rails_app/config/environments/test.rb
228
+ - spec/rails_app/config/initializers/backtrace_silencers.rb
229
+ - spec/rails_app/config/initializers/inflections.rb
230
+ - spec/rails_app/config/initializers/secret_token.rb
231
+ - spec/rails_app/config/routes.rb
232
+ - spec/rails_app/db/seeds.rb
233
+ - spec/rails_app/log/development.log
234
+ - spec/rails_app/public/404.html
235
+ - spec/rails_app/public/422.html
236
+ - spec/rails_app/public/500.html
237
+ - spec/rails_app/public/favicon.ico
238
+ - spec/rails_app/script/rails
239
+ - spec/spec_helper.rb
240
+ homepage: https://github.com/halogenandtoast/oath
241
+ licenses: []
242
+ metadata: {}
243
+ post_install_message:
244
+ rdoc_options: []
245
+ require_paths:
246
+ - lib
247
+ required_ruby_version: !ruby/object:Gem::Requirement
248
+ requirements:
249
+ - - ">="
250
+ - !ruby/object:Gem::Version
251
+ version: '0'
252
+ required_rubygems_version: !ruby/object:Gem::Requirement
253
+ requirements:
254
+ - - ">="
255
+ - !ruby/object:Gem::Version
256
+ version: '0'
257
+ requirements: []
258
+ rubyforge_project:
259
+ rubygems_version: 2.6.13
260
+ signing_key:
261
+ specification_version: 4
262
+ summary: Making rails authentication as simple as possible
263
+ test_files:
264
+ - spec/features/user/user_signs_in_spec.rb
265
+ - spec/features/user/user_signs_in_through_back_door_spec.rb
266
+ - spec/features/user/user_tries_to_access_constrained_routes_spec.rb
267
+ - spec/features/user/user_tries_to_access_http_auth_page_spec.rb
268
+ - spec/features/visitor/visitor_fails_to_sign_up_spec.rb
269
+ - spec/features/visitor/visitor_is_unauthorized_spec.rb
270
+ - spec/features/visitor/visitor_signs_in_via_invalid_form_spec.rb
271
+ - spec/features/visitor/visitor_signs_up_spec.rb
272
+ - spec/features/visitor/visitor_tries_to_access_constrained_routes_spec.rb
273
+ - spec/features/visitor/visitor_uses_remember_token_spec.rb
274
+ - spec/oath/configuration_spec.rb
275
+ - spec/oath/controller_helpers_spec.rb
276
+ - spec/oath/field_map_spec.rb
277
+ - spec/oath/services/authentication_spec.rb
278
+ - spec/oath/services/password_reset_spec.rb
279
+ - spec/oath/services/sign_in_spec.rb
280
+ - spec/oath/services/sign_out_spec.rb
281
+ - spec/oath/services/sign_up_spec.rb
282
+ - spec/oath/strategies/password_strategy_spec.rb
283
+ - spec/oath/test_controller_helpers_spec.rb
284
+ - spec/oath/test_helpers_spec.rb
285
+ - spec/oath_spec.rb
286
+ - spec/rails_app/Rakefile
287
+ - spec/rails_app/app/assets/images/rails.png
288
+ - spec/rails_app/app/assets/javascripts/application.js
289
+ - spec/rails_app/app/assets/stylesheets/application.css
290
+ - spec/rails_app/app/controllers/application_controller.rb
291
+ - spec/rails_app/app/controllers/basic_auth_controller.rb
292
+ - spec/rails_app/app/controllers/constrained_to_users_controller.rb
293
+ - spec/rails_app/app/controllers/constrained_to_visitors_controller.rb
294
+ - spec/rails_app/app/controllers/failures_controller.rb
295
+ - spec/rails_app/app/controllers/invalid_sessions_controller.rb
296
+ - spec/rails_app/app/controllers/posts_controller.rb
297
+ - spec/rails_app/app/controllers/sessions_controller.rb
298
+ - spec/rails_app/app/controllers/users_controller.rb
299
+ - spec/rails_app/app/helpers/application_helper.rb
300
+ - spec/rails_app/app/models/user.rb
301
+ - spec/rails_app/app/views/invalid_sessions/new.html.erb
302
+ - spec/rails_app/app/views/layouts/application.html.erb
303
+ - spec/rails_app/app/views/posts/index.html.erb
304
+ - spec/rails_app/app/views/sessions/new.html.erb
305
+ - spec/rails_app/app/views/users/new.html.erb
306
+ - spec/rails_app/config.ru
307
+ - spec/rails_app/config/application.rb
308
+ - spec/rails_app/config/boot.rb
309
+ - spec/rails_app/config/database.yml
310
+ - spec/rails_app/config/environment.rb
311
+ - spec/rails_app/config/environments/development.rb
312
+ - spec/rails_app/config/environments/production.rb
313
+ - spec/rails_app/config/environments/test.rb
314
+ - spec/rails_app/config/initializers/backtrace_silencers.rb
315
+ - spec/rails_app/config/initializers/inflections.rb
316
+ - spec/rails_app/config/initializers/secret_token.rb
317
+ - spec/rails_app/config/routes.rb
318
+ - spec/rails_app/db/seeds.rb
319
+ - spec/rails_app/log/development.log
320
+ - spec/rails_app/public/404.html
321
+ - spec/rails_app/public/422.html
322
+ - spec/rails_app/public/500.html
323
+ - spec/rails_app/public/favicon.ico
324
+ - spec/rails_app/script/rails
325
+ - spec/spec_helper.rb