capcoauth 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +15 -35
- data/.rspec +1 -0
- data/.travis.yml +11 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +171 -0
- data/README.md +3 -1
- data/Rakefile +7 -7
- data/app/controllers/capcoauth/application_controller.rb +8 -1
- data/app/controllers/capcoauth/login_controller.rb +5 -1
- data/app/controllers/capcoauth/logout_controller.rb +2 -6
- data/capcoauth.gemspec +13 -6
- data/lib/capcoauth/config.rb +52 -58
- data/lib/capcoauth/errors.rb +3 -0
- data/lib/capcoauth/notifications.rb +11 -9
- data/lib/capcoauth/oauth/access_token.rb +0 -1
- data/lib/capcoauth/oauth/token_verifier.rb +15 -10
- data/lib/capcoauth/rails/helpers.rb +45 -44
- data/lib/capcoauth/version.rb +11 -1
- data/lib/capcoauth.rb +1 -9
- data/lib/generators/capcoauth/templates/initializer.rb +23 -12
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/full_protected_resources_controller.rb +12 -0
- data/spec/dummy/app/controllers/home_controller.rb +17 -0
- data/spec/dummy/app/controllers/metal_controller.rb +11 -0
- data/spec/dummy/app/controllers/semi_protected_resources_controller.rb +11 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/app/views/home/index.html.erb +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +16 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/database.yml +15 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +62 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/capcoauth.rb +41 -0
- data/spec/dummy/config/initializers/secret_token.rb +9 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/routes.rb +50 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20111122132257_create_users.rb +9 -0
- data/spec/dummy/db/schema.rb +22 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/generators/install_generator_spec.rb +27 -0
- data/spec/generators/templates/routes.rb +3 -0
- data/spec/lib/capcoauth/oauth/access_token_spec.rb +31 -0
- data/spec/lib/capcoauth/oauth/token_verifier_spec.rb +121 -0
- data/spec/lib/capcoauth/oauth/ttl_cache_spec.rb +88 -0
- data/spec/lib/capcoauth_spec.rb +3 -0
- data/spec/lib/config_spec.rb +215 -0
- data/spec/lib/version_spec.rb +25 -0
- data/spec/spec_helper.rb +8 -0
- data/spec/spec_helper_integration.rb +50 -0
- data/spec/support/http_method_shim.rb +38 -0
- data/spec/support/orm/active_record.rb +3 -0
- metadata +172 -12
- data/lib/capcoauth/helpers/controller.rb +0 -15
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start 'rails'
|
3
|
+
|
4
|
+
ENV['RAILS_ENV'] ||= 'test'
|
5
|
+
TABLE_NAME_PREFIX = ENV['table_name_prefix'] || nil
|
6
|
+
TABLE_NAME_SUFFIX = ENV['table_name_suffix'] || nil
|
7
|
+
|
8
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)
|
9
|
+
|
10
|
+
require 'capybara/rspec'
|
11
|
+
require 'dummy/config/environment'
|
12
|
+
require 'rspec/rails'
|
13
|
+
require 'generator_spec/test_case'
|
14
|
+
require 'timecop'
|
15
|
+
require 'database_cleaner'
|
16
|
+
|
17
|
+
# Load JRuby SQLite3 if in that platform
|
18
|
+
begin
|
19
|
+
require 'jdbc/sqlite3'
|
20
|
+
Jdbc::SQLite3.load_driver
|
21
|
+
rescue LoadError
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'support/orm/active_record'
|
25
|
+
|
26
|
+
ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
|
27
|
+
|
28
|
+
Dir["#{File.dirname(__FILE__)}/support/{dependencies,helpers,shared}/*.rb"].each { |f| require f }
|
29
|
+
|
30
|
+
# Remove after dropping support of Rails 4.2
|
31
|
+
require "#{File.dirname(__FILE__)}/support/http_method_shim.rb"
|
32
|
+
|
33
|
+
RSpec.configure do |config|
|
34
|
+
config.infer_spec_type_from_file_location!
|
35
|
+
config.mock_with :rspec
|
36
|
+
|
37
|
+
config.infer_base_class_for_anonymous_controllers = false
|
38
|
+
|
39
|
+
config.include RSpec::Rails::RequestExampleGroup, type: :request
|
40
|
+
|
41
|
+
config.before do
|
42
|
+
DatabaseCleaner.start
|
43
|
+
end
|
44
|
+
|
45
|
+
config.after do
|
46
|
+
DatabaseCleaner.clean
|
47
|
+
end
|
48
|
+
|
49
|
+
config.order = 'random'
|
50
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Rails 5 deprecates calling HTTP action methods with positional arguments
|
2
|
+
# in favor of keyword arguments. However, the keyword argument form is only
|
3
|
+
# supported in Rails 5+. Since we support back to 4, we need some sort of shim
|
4
|
+
# to avoid super noisy deprecations when running tests.
|
5
|
+
module RoutingHTTPMethodShim
|
6
|
+
def get(path, params = {}, headers = nil)
|
7
|
+
super(path, params: params, headers: headers)
|
8
|
+
end
|
9
|
+
|
10
|
+
def post(path, params = {}, headers = nil)
|
11
|
+
super(path, params: params, headers: headers)
|
12
|
+
end
|
13
|
+
|
14
|
+
def put(path, params = {}, headers = nil)
|
15
|
+
super(path, params: params, headers: headers)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module ControllerHTTPMethodShim
|
20
|
+
def get(path, params = {})
|
21
|
+
super(path, params: params)
|
22
|
+
end
|
23
|
+
|
24
|
+
def post(path, params = {})
|
25
|
+
super(path, params: params)
|
26
|
+
end
|
27
|
+
|
28
|
+
def put(path, params = {})
|
29
|
+
super(path, params: params)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
if ::Rails::VERSION::MAJOR >= 5
|
34
|
+
RSpec.configure do |config|
|
35
|
+
config.include ControllerHTTPMethodShim, type: :controller
|
36
|
+
config.include RoutingHTTPMethodShim, type: :request
|
37
|
+
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capcoauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Robertson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -50,42 +50,112 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.14'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0.
|
60
|
+
version: '0.14'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: capybara
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: database_cleaner
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 1.5.3
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 1.5.3
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: factory_girl
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 4.7.0
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 4.7.0
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: generator_spec
|
63
105
|
requirement: !ruby/object:Gem::Requirement
|
64
106
|
requirements:
|
65
107
|
- - "~>"
|
66
108
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
109
|
+
version: 0.9.3
|
68
110
|
type: :development
|
69
111
|
prerelease: false
|
70
112
|
version_requirements: !ruby/object:Gem::Requirement
|
71
113
|
requirements:
|
72
114
|
- - "~>"
|
73
115
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
116
|
+
version: 0.9.3
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: rake
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 11.3.0
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 11.3.0
|
75
131
|
- !ruby/object:Gem::Dependency
|
76
132
|
name: rspec-rails
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: timecop
|
77
147
|
requirement: !ruby/object:Gem::Requirement
|
78
148
|
requirements:
|
79
149
|
- - "~>"
|
80
150
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
151
|
+
version: 0.8.1
|
82
152
|
type: :development
|
83
153
|
prerelease: false
|
84
154
|
version_requirements: !ruby/object:Gem::Requirement
|
85
155
|
requirements:
|
86
156
|
- - "~>"
|
87
157
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
158
|
+
version: 0.8.1
|
89
159
|
description: capcoauth-gem is a library to integrate Rails applications with Capcoauth
|
90
160
|
authentication service
|
91
161
|
email:
|
@@ -95,6 +165,10 @@ extensions: []
|
|
95
165
|
extra_rdoc_files: []
|
96
166
|
files:
|
97
167
|
- ".gitignore"
|
168
|
+
- ".rspec"
|
169
|
+
- ".travis.yml"
|
170
|
+
- Gemfile
|
171
|
+
- Gemfile.lock
|
98
172
|
- LICENSE
|
99
173
|
- README.md
|
100
174
|
- Rakefile
|
@@ -106,7 +180,7 @@ files:
|
|
106
180
|
- lib/capcoauth.rb
|
107
181
|
- lib/capcoauth/config.rb
|
108
182
|
- lib/capcoauth/engine.rb
|
109
|
-
- lib/capcoauth/
|
183
|
+
- lib/capcoauth/errors.rb
|
110
184
|
- lib/capcoauth/notifications.rb
|
111
185
|
- lib/capcoauth/oauth/access_token.rb
|
112
186
|
- lib/capcoauth/oauth/token_verifier.rb
|
@@ -119,6 +193,49 @@ files:
|
|
119
193
|
- lib/generators/capcoauth/install_generator.rb
|
120
194
|
- lib/generators/capcoauth/templates/README
|
121
195
|
- lib/generators/capcoauth/templates/initializer.rb
|
196
|
+
- spec/dummy/Rakefile
|
197
|
+
- spec/dummy/app/controllers/application_controller.rb
|
198
|
+
- spec/dummy/app/controllers/full_protected_resources_controller.rb
|
199
|
+
- spec/dummy/app/controllers/home_controller.rb
|
200
|
+
- spec/dummy/app/controllers/metal_controller.rb
|
201
|
+
- spec/dummy/app/controllers/semi_protected_resources_controller.rb
|
202
|
+
- spec/dummy/app/models/user.rb
|
203
|
+
- spec/dummy/app/views/home/index.html.erb
|
204
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
205
|
+
- spec/dummy/config.ru
|
206
|
+
- spec/dummy/config/application.rb
|
207
|
+
- spec/dummy/config/boot.rb
|
208
|
+
- spec/dummy/config/database.yml
|
209
|
+
- spec/dummy/config/environment.rb
|
210
|
+
- spec/dummy/config/environments/development.rb
|
211
|
+
- spec/dummy/config/environments/production.rb
|
212
|
+
- spec/dummy/config/environments/test.rb
|
213
|
+
- spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb
|
214
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
215
|
+
- spec/dummy/config/initializers/capcoauth.rb
|
216
|
+
- spec/dummy/config/initializers/secret_token.rb
|
217
|
+
- spec/dummy/config/initializers/session_store.rb
|
218
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
219
|
+
- spec/dummy/config/routes.rb
|
220
|
+
- spec/dummy/db/migrate/20111122132257_create_users.rb
|
221
|
+
- spec/dummy/db/schema.rb
|
222
|
+
- spec/dummy/public/404.html
|
223
|
+
- spec/dummy/public/422.html
|
224
|
+
- spec/dummy/public/500.html
|
225
|
+
- spec/dummy/public/favicon.ico
|
226
|
+
- spec/dummy/script/rails
|
227
|
+
- spec/generators/install_generator_spec.rb
|
228
|
+
- spec/generators/templates/routes.rb
|
229
|
+
- spec/lib/capcoauth/oauth/access_token_spec.rb
|
230
|
+
- spec/lib/capcoauth/oauth/token_verifier_spec.rb
|
231
|
+
- spec/lib/capcoauth/oauth/ttl_cache_spec.rb
|
232
|
+
- spec/lib/capcoauth_spec.rb
|
233
|
+
- spec/lib/config_spec.rb
|
234
|
+
- spec/lib/version_spec.rb
|
235
|
+
- spec/spec_helper.rb
|
236
|
+
- spec/spec_helper_integration.rb
|
237
|
+
- spec/support/http_method_shim.rb
|
238
|
+
- spec/support/orm/active_record.rb
|
122
239
|
homepage: https://github.com/arcreative/capcoauth-gem
|
123
240
|
licenses:
|
124
241
|
- MIT
|
@@ -131,7 +248,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
248
|
requirements:
|
132
249
|
- - ">="
|
133
250
|
- !ruby/object:Gem::Version
|
134
|
-
version: '
|
251
|
+
version: '2.1'
|
135
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
253
|
requirements:
|
137
254
|
- - ">="
|
@@ -143,4 +260,47 @@ rubygems_version: 2.6.7
|
|
143
260
|
signing_key:
|
144
261
|
specification_version: 4
|
145
262
|
summary: Integration with Capcoauth authentication service
|
146
|
-
test_files:
|
263
|
+
test_files:
|
264
|
+
- spec/dummy/Rakefile
|
265
|
+
- spec/dummy/app/controllers/application_controller.rb
|
266
|
+
- spec/dummy/app/controllers/full_protected_resources_controller.rb
|
267
|
+
- spec/dummy/app/controllers/home_controller.rb
|
268
|
+
- spec/dummy/app/controllers/metal_controller.rb
|
269
|
+
- spec/dummy/app/controllers/semi_protected_resources_controller.rb
|
270
|
+
- spec/dummy/app/models/user.rb
|
271
|
+
- spec/dummy/app/views/home/index.html.erb
|
272
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
273
|
+
- spec/dummy/config.ru
|
274
|
+
- spec/dummy/config/application.rb
|
275
|
+
- spec/dummy/config/boot.rb
|
276
|
+
- spec/dummy/config/database.yml
|
277
|
+
- spec/dummy/config/environment.rb
|
278
|
+
- spec/dummy/config/environments/development.rb
|
279
|
+
- spec/dummy/config/environments/production.rb
|
280
|
+
- spec/dummy/config/environments/test.rb
|
281
|
+
- spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb
|
282
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
283
|
+
- spec/dummy/config/initializers/capcoauth.rb
|
284
|
+
- spec/dummy/config/initializers/secret_token.rb
|
285
|
+
- spec/dummy/config/initializers/session_store.rb
|
286
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
287
|
+
- spec/dummy/config/routes.rb
|
288
|
+
- spec/dummy/db/migrate/20111122132257_create_users.rb
|
289
|
+
- spec/dummy/db/schema.rb
|
290
|
+
- spec/dummy/public/404.html
|
291
|
+
- spec/dummy/public/422.html
|
292
|
+
- spec/dummy/public/500.html
|
293
|
+
- spec/dummy/public/favicon.ico
|
294
|
+
- spec/dummy/script/rails
|
295
|
+
- spec/generators/install_generator_spec.rb
|
296
|
+
- spec/generators/templates/routes.rb
|
297
|
+
- spec/lib/capcoauth/oauth/access_token_spec.rb
|
298
|
+
- spec/lib/capcoauth/oauth/token_verifier_spec.rb
|
299
|
+
- spec/lib/capcoauth/oauth/ttl_cache_spec.rb
|
300
|
+
- spec/lib/capcoauth_spec.rb
|
301
|
+
- spec/lib/config_spec.rb
|
302
|
+
- spec/lib/version_spec.rb
|
303
|
+
- spec/spec_helper.rb
|
304
|
+
- spec/spec_helper_integration.rb
|
305
|
+
- spec/support/http_method_shim.rb
|
306
|
+
- spec/support/orm/active_record.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Capcoauth
|
2
|
-
module Helpers
|
3
|
-
module Controller
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
def capcoauth_token
|
7
|
-
@capcoauth_token ||= OAuth::AccessToken.new(session[:capcoauth_access_token])
|
8
|
-
end
|
9
|
-
|
10
|
-
def oauth_callback_url
|
11
|
-
"#{root_url}auth/callback"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|