doorkeeper-grants_assertion 0.0.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87bb84b4d2dda652ff143b5c6e8f532c7dcb875c
4
- data.tar.gz: 82792c4551fb2938c4492b995e4a0e1c76a41728
3
+ metadata.gz: fe45810cef0bca0a2243cd9c09d2767a1fee6289
4
+ data.tar.gz: a5e2f927e70a85096f7526ac8b5dbf8fbbd66109
5
5
  SHA512:
6
- metadata.gz: 1f7410f081c0b09f24102ff531acc1b37eb7e753515657caa6e74c9c83ba4e4916b4e3d61ec9883275065eaef4b4f421d54294341d09c7653aca0b8336f0aca8
7
- data.tar.gz: 91eaaeaa2c25ec48dde6b9ed544b079950dbb2de07cc0482d35c3b688ed4e05fdfc6dc841a51b17381b1e48f325ee020562d028620ce5588ef8ac893f35c8c80
6
+ metadata.gz: 8be250865b02e5588f501d71a4853f51aec57c3d8428d815dc9ffe108c96aa08c5f44bb69bff01e1bedae847e2427f0bc9acc6b6380a91bf0efbc14f322eb32e
7
+ data.tar.gz: 78d12750415187a141713d19556801330f42a928777c6f0af8731782a75c3d35b9b19e25fd0da67f0fc501418d51190311e9ee1858682f50dd55e1607379cdda
@@ -0,0 +1,21 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.1
5
+ - 2.2.6
6
+ - 2.3.3
7
+ - 2.4
8
+
9
+ gemfile:
10
+ - gemfiles/rails_4_2.gemfile
11
+ - gemfiles/rails_5_0.gemfile
12
+ - gemfiles/rails_latest_and_doorkeeper_latest.gemfile
13
+
14
+ matrix:
15
+ exclude:
16
+ - gemfile: gemfiles/rails_5_0.gemfile
17
+ rvm: 2.1
18
+ - gemfile: gemfiles/rails_latest_and_doorkeeper_latest.gemfile
19
+ rvm: 2.1
20
+ allowed_failures:
21
+ - gemfile: gemfiles/rails_latest_and_doorkeeper_latest.gemfile
@@ -0,0 +1,15 @@
1
+ appraise 'rails-4-2' do
2
+ gem 'rails', '~> 4.2.0'
3
+ gem 'doorkeeper', '~> 4.2.0'
4
+ end
5
+
6
+ appraise 'rails-5-0' do
7
+ gem 'rails', '~> 5.0.0'
8
+ gem 'doorkeeper', '~> 4.2.0'
9
+ end
10
+
11
+ appraise 'rails-latest-and-doorkeeper-latest' do
12
+ gem 'rails', github: 'rails/rails'
13
+ gem 'arel', github: 'rails/arel'
14
+ gem 'doorkeeper', github: 'doorkeeper-gem/doorkeeper'
15
+ end
data/Gemfile CHANGED
@@ -1,12 +1,13 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Define Rails version
4
- gem 'rails', ENV['rails']
4
+ gem 'rails', '~> 4.2.0'
5
5
 
6
- gem 'doorkeeper'
6
+ gem 'doorkeeper', '~> 4.2.0'
7
7
 
8
8
  gem 'pry'
9
9
  gem 'sqlite3'
10
10
  gem 'factory_girl'
11
+ gem 'appraisal'
11
12
 
12
13
  gemspec
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # Doorkeeper - Assertion Grant Extension
2
2
 
3
+ [![Travis CI](https://img.shields.io/travis/doorkeeper-gem/doorkeeper-grants_assertion/master.svg)](https://travis-ci.org/doorkeeper-gem/doorkeeper-grants_assertion)
4
+
3
5
  Assertion grant extension for Doorkeeper. Born from:
4
6
  https://github.com/doorkeeper-gem/doorkeeper/pull/249
5
7
 
6
- ## Instalation
8
+ ## Installation
7
9
 
8
10
  1. Add both gems to your `Gemfile`.
9
11
  2. Add `assertion` as a `grant_flow` to your initializer.
@@ -22,9 +24,27 @@ Doorkeeper.configure do
22
24
  user_data = JSON.parse(response.body)
23
25
  User.find_by_facebook_id(user_data['id'])
24
26
  end
27
+
28
+ # add your supported grant types and other extensions
29
+ grant_flows %w(assertion authorization_code implicit password client_credentials)
25
30
  end
26
31
  ```
27
32
 
33
+ If you want to ensure that resource owners can only receive access tokens scoped to a specific application, you'll need to add that logic in to the definition as well:
34
+
35
+ ```ruby
36
+ Doorkeeper.configure do
37
+ resource_owner_from_assertion do
38
+ Doorkeeper::Application.find_by!(uid: params[:client_id]) #will raise an exception if not found
39
+ facebook = URI.parse('https://graph.facebook.com/me?access_token=' +
40
+ params[:assertion])
41
+ ....continue with authentication lookup....
42
+ ```
43
+ More complete examples, also for other providers may be found in the [wiki](https://github.com/doorkeeper-gem/doorkeeper-grants_assertion/wiki).
28
44
  ___
29
45
 
30
- IETF standard: http://tools.ietf.org/html/draft-ietf-oauth-assertions-16
46
+ IETF standard: http://tools.ietf.org/html/rfc7521
47
+
48
+ ## Supported versions
49
+
50
+ Assertion grant extension for Doorkeeper is tested with Rails 4.2 and 5.0.
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'bundler/setup'
2
2
  require 'rspec/core/rake_task'
3
+ require 'appraisal'
3
4
 
4
5
  desc 'Default: run specs.'
5
6
  task :default => :spec
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'doorkeeper-grants_assertion'
3
- s.version = '0.0.1'
3
+ s.version = '0.1.0'
4
4
  s.authors = ['Tute Costa']
5
5
  s.email = ['tutecosta@gmail.com']
6
6
  s.homepage = "https://github.com/doorkeeper-gem/doorkeeper/doorkeeper-grants-assertion"
@@ -13,9 +13,9 @@ Gem::Specification.new do |s|
13
13
  s.require_paths = ["lib"]
14
14
 
15
15
  s.add_dependency "railties", ">= 3.1"
16
- s.add_dependency "doorkeeper", ">= 1.3"
16
+ s.add_dependency "doorkeeper", ">= 4.0"
17
17
  s.add_development_dependency "rspec-rails", ">= 2.11.4"
18
- s.add_development_dependency "capybara", "~> 1.1.2"
18
+ s.add_development_dependency "capybara", ">= 2.2.0"
19
19
  s.add_development_dependency "factory_girl", "~> 2.6.4"
20
20
  s.add_development_dependency "generator_spec", "~> 0.9.0"
21
21
  s.add_development_dependency "database_cleaner", "~> 1.2.0"
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 4.2.0"
6
+ gem "doorkeeper", "~> 4.2.0"
7
+ gem "pry"
8
+ gem "sqlite3"
9
+ gem "factory_girl"
10
+ gem "appraisal"
11
+
12
+ gemspec path: "../"
@@ -0,0 +1,171 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ doorkeeper-grants_assertion (0.1.0)
5
+ doorkeeper (>= 4.0)
6
+ railties (>= 3.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (4.2.10)
12
+ actionpack (= 4.2.10)
13
+ actionview (= 4.2.10)
14
+ activejob (= 4.2.10)
15
+ mail (~> 2.5, >= 2.5.4)
16
+ rails-dom-testing (~> 1.0, >= 1.0.5)
17
+ actionpack (4.2.10)
18
+ actionview (= 4.2.10)
19
+ activesupport (= 4.2.10)
20
+ rack (~> 1.6)
21
+ rack-test (~> 0.6.2)
22
+ rails-dom-testing (~> 1.0, >= 1.0.5)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
+ actionview (4.2.10)
25
+ activesupport (= 4.2.10)
26
+ builder (~> 3.1)
27
+ erubis (~> 2.7.0)
28
+ rails-dom-testing (~> 1.0, >= 1.0.5)
29
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
30
+ activejob (4.2.10)
31
+ activesupport (= 4.2.10)
32
+ globalid (>= 0.3.0)
33
+ activemodel (4.2.10)
34
+ activesupport (= 4.2.10)
35
+ builder (~> 3.1)
36
+ activerecord (4.2.10)
37
+ activemodel (= 4.2.10)
38
+ activesupport (= 4.2.10)
39
+ arel (~> 6.0)
40
+ activesupport (4.2.10)
41
+ i18n (~> 0.7)
42
+ minitest (~> 5.1)
43
+ thread_safe (~> 0.3, >= 0.3.4)
44
+ tzinfo (~> 1.1)
45
+ addressable (2.5.2)
46
+ public_suffix (>= 2.0.2, < 4.0)
47
+ appraisal (2.2.0)
48
+ bundler
49
+ rake
50
+ thor (>= 0.14.0)
51
+ arel (6.0.4)
52
+ builder (3.2.3)
53
+ capybara (2.15.4)
54
+ addressable
55
+ mini_mime (>= 0.1.3)
56
+ nokogiri (>= 1.3.3)
57
+ rack (>= 1.0.0)
58
+ rack-test (>= 0.5.4)
59
+ xpath (~> 2.0)
60
+ coderay (1.1.2)
61
+ concurrent-ruby (1.0.5)
62
+ crass (1.0.2)
63
+ database_cleaner (1.2.0)
64
+ diff-lcs (1.3)
65
+ doorkeeper (4.2.6)
66
+ railties (>= 4.2)
67
+ erubis (2.7.0)
68
+ factory_girl (4.8.1)
69
+ activesupport (>= 3.0.0)
70
+ generator_spec (0.9.4)
71
+ activesupport (>= 3.0.0)
72
+ railties (>= 3.0.0)
73
+ globalid (0.4.0)
74
+ activesupport (>= 4.2.0)
75
+ i18n (0.8.6)
76
+ loofah (2.1.1)
77
+ crass (~> 1.0.2)
78
+ nokogiri (>= 1.5.9)
79
+ mail (2.6.6)
80
+ mime-types (>= 1.16, < 4)
81
+ method_source (0.9.0)
82
+ mime-types (3.1)
83
+ mime-types-data (~> 3.2015)
84
+ mime-types-data (3.2016.0521)
85
+ mini_mime (0.1.4)
86
+ mini_portile2 (2.3.0)
87
+ minitest (5.10.3)
88
+ nokogiri (1.8.1)
89
+ mini_portile2 (~> 2.3.0)
90
+ pry (0.11.1)
91
+ coderay (~> 1.1.0)
92
+ method_source (~> 0.9.0)
93
+ public_suffix (3.0.0)
94
+ rack (1.6.8)
95
+ rack-test (0.6.3)
96
+ rack (>= 1.0)
97
+ rails (4.2.10)
98
+ actionmailer (= 4.2.10)
99
+ actionpack (= 4.2.10)
100
+ actionview (= 4.2.10)
101
+ activejob (= 4.2.10)
102
+ activemodel (= 4.2.10)
103
+ activerecord (= 4.2.10)
104
+ activesupport (= 4.2.10)
105
+ bundler (>= 1.3.0, < 2.0)
106
+ railties (= 4.2.10)
107
+ sprockets-rails
108
+ rails-deprecated_sanitizer (1.0.3)
109
+ activesupport (>= 4.2.0.alpha)
110
+ rails-dom-testing (1.0.8)
111
+ activesupport (>= 4.2.0.beta, < 5.0)
112
+ nokogiri (~> 1.6)
113
+ rails-deprecated_sanitizer (>= 1.0.1)
114
+ rails-html-sanitizer (1.0.3)
115
+ loofah (~> 2.0)
116
+ railties (4.2.10)
117
+ actionpack (= 4.2.10)
118
+ activesupport (= 4.2.10)
119
+ rake (>= 0.8.7)
120
+ thor (>= 0.18.1, < 2.0)
121
+ rake (12.1.0)
122
+ rspec-core (3.6.0)
123
+ rspec-support (~> 3.6.0)
124
+ rspec-expectations (3.6.0)
125
+ diff-lcs (>= 1.2.0, < 2.0)
126
+ rspec-support (~> 3.6.0)
127
+ rspec-mocks (3.6.0)
128
+ diff-lcs (>= 1.2.0, < 2.0)
129
+ rspec-support (~> 3.6.0)
130
+ rspec-rails (3.6.1)
131
+ actionpack (>= 3.0)
132
+ activesupport (>= 3.0)
133
+ railties (>= 3.0)
134
+ rspec-core (~> 3.6.0)
135
+ rspec-expectations (~> 3.6.0)
136
+ rspec-mocks (~> 3.6.0)
137
+ rspec-support (~> 3.6.0)
138
+ rspec-support (3.6.0)
139
+ sprockets (3.7.1)
140
+ concurrent-ruby (~> 1.0)
141
+ rack (> 1, < 3)
142
+ sprockets-rails (3.2.1)
143
+ actionpack (>= 4.0)
144
+ activesupport (>= 4.0)
145
+ sprockets (>= 3.0.0)
146
+ sqlite3 (1.3.13)
147
+ thor (0.20.0)
148
+ thread_safe (0.3.6)
149
+ tzinfo (1.2.3)
150
+ thread_safe (~> 0.1)
151
+ xpath (2.1.0)
152
+ nokogiri (~> 1.3)
153
+
154
+ PLATFORMS
155
+ ruby
156
+
157
+ DEPENDENCIES
158
+ appraisal
159
+ capybara (>= 2.2.0)
160
+ database_cleaner (~> 1.2.0)
161
+ doorkeeper (~> 4.2.0)
162
+ doorkeeper-grants_assertion!
163
+ factory_girl
164
+ generator_spec (~> 0.9.0)
165
+ pry
166
+ rails (~> 4.2.0)
167
+ rspec-rails (>= 2.11.4)
168
+ sqlite3
169
+
170
+ BUNDLED WITH
171
+ 1.16.0
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 5.0.0"
6
+ gem "doorkeeper", "~> 4.2.0"
7
+ gem "pry"
8
+ gem "sqlite3"
9
+ gem "factory_girl"
10
+ gem "appraisal"
11
+
12
+ gemspec path: "../"
@@ -0,0 +1,177 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ doorkeeper-grants_assertion (0.1.0)
5
+ doorkeeper (>= 4.0)
6
+ railties (>= 3.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (5.0.0.1)
12
+ actionpack (= 5.0.0.1)
13
+ nio4r (~> 1.2)
14
+ websocket-driver (~> 0.6.1)
15
+ actionmailer (5.0.0.1)
16
+ actionpack (= 5.0.0.1)
17
+ actionview (= 5.0.0.1)
18
+ activejob (= 5.0.0.1)
19
+ mail (~> 2.5, >= 2.5.4)
20
+ rails-dom-testing (~> 2.0)
21
+ actionpack (5.0.0.1)
22
+ actionview (= 5.0.0.1)
23
+ activesupport (= 5.0.0.1)
24
+ rack (~> 2.0)
25
+ rack-test (~> 0.6.3)
26
+ rails-dom-testing (~> 2.0)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ actionview (5.0.0.1)
29
+ activesupport (= 5.0.0.1)
30
+ builder (~> 3.1)
31
+ erubis (~> 2.7.0)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
34
+ activejob (5.0.0.1)
35
+ activesupport (= 5.0.0.1)
36
+ globalid (>= 0.3.6)
37
+ activemodel (5.0.0.1)
38
+ activesupport (= 5.0.0.1)
39
+ activerecord (5.0.0.1)
40
+ activemodel (= 5.0.0.1)
41
+ activesupport (= 5.0.0.1)
42
+ arel (~> 7.0)
43
+ activesupport (5.0.0.1)
44
+ concurrent-ruby (~> 1.0, >= 1.0.2)
45
+ i18n (~> 0.7)
46
+ minitest (~> 5.1)
47
+ tzinfo (~> 1.1)
48
+ addressable (2.5.2)
49
+ public_suffix (>= 2.0.2, < 4.0)
50
+ appraisal (2.2.0)
51
+ bundler
52
+ rake
53
+ thor (>= 0.14.0)
54
+ arel (7.1.4)
55
+ builder (3.2.3)
56
+ capybara (2.15.4)
57
+ addressable
58
+ mini_mime (>= 0.1.3)
59
+ nokogiri (>= 1.3.3)
60
+ rack (>= 1.0.0)
61
+ rack-test (>= 0.5.4)
62
+ xpath (~> 2.0)
63
+ coderay (1.1.2)
64
+ concurrent-ruby (1.0.5)
65
+ crass (1.0.2)
66
+ database_cleaner (1.2.0)
67
+ diff-lcs (1.3)
68
+ doorkeeper (4.2.6)
69
+ railties (>= 4.2)
70
+ erubis (2.7.0)
71
+ factory_girl (4.8.1)
72
+ activesupport (>= 3.0.0)
73
+ generator_spec (0.9.4)
74
+ activesupport (>= 3.0.0)
75
+ railties (>= 3.0.0)
76
+ globalid (0.4.0)
77
+ activesupport (>= 4.2.0)
78
+ i18n (0.8.6)
79
+ loofah (2.1.1)
80
+ crass (~> 1.0.2)
81
+ nokogiri (>= 1.5.9)
82
+ mail (2.6.6)
83
+ mime-types (>= 1.16, < 4)
84
+ method_source (0.9.0)
85
+ mime-types (3.1)
86
+ mime-types-data (~> 3.2015)
87
+ mime-types-data (3.2016.0521)
88
+ mini_mime (0.1.4)
89
+ mini_portile2 (2.3.0)
90
+ minitest (5.10.3)
91
+ nio4r (1.2.1)
92
+ nokogiri (1.8.1)
93
+ mini_portile2 (~> 2.3.0)
94
+ pry (0.11.1)
95
+ coderay (~> 1.1.0)
96
+ method_source (~> 0.9.0)
97
+ public_suffix (3.0.0)
98
+ rack (2.0.3)
99
+ rack-test (0.6.3)
100
+ rack (>= 1.0)
101
+ rails (5.0.0.1)
102
+ actioncable (= 5.0.0.1)
103
+ actionmailer (= 5.0.0.1)
104
+ actionpack (= 5.0.0.1)
105
+ actionview (= 5.0.0.1)
106
+ activejob (= 5.0.0.1)
107
+ activemodel (= 5.0.0.1)
108
+ activerecord (= 5.0.0.1)
109
+ activesupport (= 5.0.0.1)
110
+ bundler (>= 1.3.0, < 2.0)
111
+ railties (= 5.0.0.1)
112
+ sprockets-rails (>= 2.0.0)
113
+ rails-dom-testing (2.0.3)
114
+ activesupport (>= 4.2.0)
115
+ nokogiri (>= 1.6)
116
+ rails-html-sanitizer (1.0.3)
117
+ loofah (~> 2.0)
118
+ railties (5.0.0.1)
119
+ actionpack (= 5.0.0.1)
120
+ activesupport (= 5.0.0.1)
121
+ method_source
122
+ rake (>= 0.8.7)
123
+ thor (>= 0.18.1, < 2.0)
124
+ rake (12.1.0)
125
+ rspec-core (3.6.0)
126
+ rspec-support (~> 3.6.0)
127
+ rspec-expectations (3.6.0)
128
+ diff-lcs (>= 1.2.0, < 2.0)
129
+ rspec-support (~> 3.6.0)
130
+ rspec-mocks (3.6.0)
131
+ diff-lcs (>= 1.2.0, < 2.0)
132
+ rspec-support (~> 3.6.0)
133
+ rspec-rails (3.6.1)
134
+ actionpack (>= 3.0)
135
+ activesupport (>= 3.0)
136
+ railties (>= 3.0)
137
+ rspec-core (~> 3.6.0)
138
+ rspec-expectations (~> 3.6.0)
139
+ rspec-mocks (~> 3.6.0)
140
+ rspec-support (~> 3.6.0)
141
+ rspec-support (3.6.0)
142
+ sprockets (3.7.1)
143
+ concurrent-ruby (~> 1.0)
144
+ rack (> 1, < 3)
145
+ sprockets-rails (3.2.1)
146
+ actionpack (>= 4.0)
147
+ activesupport (>= 4.0)
148
+ sprockets (>= 3.0.0)
149
+ sqlite3 (1.3.13)
150
+ thor (0.20.0)
151
+ thread_safe (0.3.6)
152
+ tzinfo (1.2.3)
153
+ thread_safe (~> 0.1)
154
+ websocket-driver (0.6.5)
155
+ websocket-extensions (>= 0.1.0)
156
+ websocket-extensions (0.1.2)
157
+ xpath (2.1.0)
158
+ nokogiri (~> 1.3)
159
+
160
+ PLATFORMS
161
+ ruby
162
+
163
+ DEPENDENCIES
164
+ appraisal
165
+ capybara (>= 2.2.0)
166
+ database_cleaner (~> 1.2.0)
167
+ doorkeeper (~> 4.2.0)
168
+ doorkeeper-grants_assertion!
169
+ factory_girl
170
+ generator_spec (~> 0.9.0)
171
+ pry
172
+ rails (~> 5.0.0)
173
+ rspec-rails (>= 2.11.4)
174
+ sqlite3
175
+
176
+ BUNDLED WITH
177
+ 1.16.0
@@ -0,0 +1,13 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", github: "rails/rails"
6
+ gem "doorkeeper", github: "doorkeeper-gem/doorkeeper"
7
+ gem "pry"
8
+ gem "sqlite3"
9
+ gem "factory_girl"
10
+ gem "appraisal"
11
+ gem "arel", github: "rails/arel"
12
+
13
+ gemspec path: "../"
@@ -0,0 +1,197 @@
1
+ GIT
2
+ remote: git://github.com/doorkeeper-gem/doorkeeper.git
3
+ revision: c586ab379ed8cbac7fa27fd89da9a42441d3d962
4
+ specs:
5
+ doorkeeper (4.2.6)
6
+ railties (>= 4.2)
7
+
8
+ GIT
9
+ remote: git://github.com/rails/arel.git
10
+ revision: 5cc7e774bb4d2190236cdbf46d66c89507ac6933
11
+ specs:
12
+ arel (9.0.0.alpha)
13
+
14
+ GIT
15
+ remote: git://github.com/rails/rails.git
16
+ revision: a92e4bfff31dd862e842bd68ddd78f3db720b3a4
17
+ specs:
18
+ actioncable (5.2.0.alpha)
19
+ actionpack (= 5.2.0.alpha)
20
+ nio4r (~> 2.0)
21
+ websocket-driver (~> 0.6.1)
22
+ actionmailer (5.2.0.alpha)
23
+ actionpack (= 5.2.0.alpha)
24
+ actionview (= 5.2.0.alpha)
25
+ activejob (= 5.2.0.alpha)
26
+ mail (~> 2.5, >= 2.5.4)
27
+ rails-dom-testing (~> 2.0)
28
+ actionpack (5.2.0.alpha)
29
+ actionview (= 5.2.0.alpha)
30
+ activesupport (= 5.2.0.alpha)
31
+ rack (~> 2.0)
32
+ rack-test (>= 0.6.3)
33
+ rails-dom-testing (~> 2.0)
34
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
35
+ actionview (5.2.0.alpha)
36
+ activesupport (= 5.2.0.alpha)
37
+ builder (~> 3.1)
38
+ erubi (~> 1.4)
39
+ rails-dom-testing (~> 2.0)
40
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
41
+ activejob (5.2.0.alpha)
42
+ activesupport (= 5.2.0.alpha)
43
+ globalid (>= 0.3.6)
44
+ activemodel (5.2.0.alpha)
45
+ activesupport (= 5.2.0.alpha)
46
+ activerecord (5.2.0.alpha)
47
+ activemodel (= 5.2.0.alpha)
48
+ activesupport (= 5.2.0.alpha)
49
+ arel (= 9.0.0.alpha)
50
+ activestorage (5.2.0.alpha)
51
+ actionpack (= 5.2.0.alpha)
52
+ activerecord (= 5.2.0.alpha)
53
+ activesupport (5.2.0.alpha)
54
+ concurrent-ruby (~> 1.0, >= 1.0.2)
55
+ i18n (~> 0.7)
56
+ minitest (~> 5.1)
57
+ tzinfo (~> 1.1)
58
+ rails (5.2.0.alpha)
59
+ actioncable (= 5.2.0.alpha)
60
+ actionmailer (= 5.2.0.alpha)
61
+ actionpack (= 5.2.0.alpha)
62
+ actionview (= 5.2.0.alpha)
63
+ activejob (= 5.2.0.alpha)
64
+ activemodel (= 5.2.0.alpha)
65
+ activerecord (= 5.2.0.alpha)
66
+ activestorage (= 5.2.0.alpha)
67
+ activesupport (= 5.2.0.alpha)
68
+ bundler (>= 1.3.0)
69
+ railties (= 5.2.0.alpha)
70
+ sprockets-rails (>= 2.0.0)
71
+ railties (5.2.0.alpha)
72
+ actionpack (= 5.2.0.alpha)
73
+ activesupport (= 5.2.0.alpha)
74
+ method_source
75
+ rake (>= 0.8.7)
76
+ thor (>= 0.18.1, < 2.0)
77
+
78
+ PATH
79
+ remote: ..
80
+ specs:
81
+ doorkeeper-grants_assertion (0.1.0)
82
+ doorkeeper (>= 4.0)
83
+ railties (>= 3.1)
84
+
85
+ GEM
86
+ remote: https://rubygems.org/
87
+ specs:
88
+ addressable (2.5.2)
89
+ public_suffix (>= 2.0.2, < 4.0)
90
+ appraisal (2.2.0)
91
+ bundler
92
+ rake
93
+ thor (>= 0.14.0)
94
+ builder (3.2.3)
95
+ capybara (2.15.4)
96
+ addressable
97
+ mini_mime (>= 0.1.3)
98
+ nokogiri (>= 1.3.3)
99
+ rack (>= 1.0.0)
100
+ rack-test (>= 0.5.4)
101
+ xpath (~> 2.0)
102
+ coderay (1.1.2)
103
+ concurrent-ruby (1.0.5)
104
+ crass (1.0.2)
105
+ database_cleaner (1.2.0)
106
+ diff-lcs (1.3)
107
+ erubi (1.7.0)
108
+ factory_girl (4.8.1)
109
+ activesupport (>= 3.0.0)
110
+ generator_spec (0.9.4)
111
+ activesupport (>= 3.0.0)
112
+ railties (>= 3.0.0)
113
+ globalid (0.4.0)
114
+ activesupport (>= 4.2.0)
115
+ i18n (0.8.6)
116
+ loofah (2.1.1)
117
+ crass (~> 1.0.2)
118
+ nokogiri (>= 1.5.9)
119
+ mail (2.6.6)
120
+ mime-types (>= 1.16, < 4)
121
+ method_source (0.9.0)
122
+ mime-types (3.1)
123
+ mime-types-data (~> 3.2015)
124
+ mime-types-data (3.2016.0521)
125
+ mini_mime (0.1.4)
126
+ mini_portile2 (2.3.0)
127
+ minitest (5.10.3)
128
+ nio4r (2.1.0)
129
+ nokogiri (1.8.1)
130
+ mini_portile2 (~> 2.3.0)
131
+ pry (0.11.1)
132
+ coderay (~> 1.1.0)
133
+ method_source (~> 0.9.0)
134
+ public_suffix (3.0.0)
135
+ rack (2.0.3)
136
+ rack-test (0.7.0)
137
+ rack (>= 1.0, < 3)
138
+ rails-dom-testing (2.0.3)
139
+ activesupport (>= 4.2.0)
140
+ nokogiri (>= 1.6)
141
+ rails-html-sanitizer (1.0.3)
142
+ loofah (~> 2.0)
143
+ rake (12.1.0)
144
+ rspec-core (3.6.0)
145
+ rspec-support (~> 3.6.0)
146
+ rspec-expectations (3.6.0)
147
+ diff-lcs (>= 1.2.0, < 2.0)
148
+ rspec-support (~> 3.6.0)
149
+ rspec-mocks (3.6.0)
150
+ diff-lcs (>= 1.2.0, < 2.0)
151
+ rspec-support (~> 3.6.0)
152
+ rspec-rails (3.6.1)
153
+ actionpack (>= 3.0)
154
+ activesupport (>= 3.0)
155
+ railties (>= 3.0)
156
+ rspec-core (~> 3.6.0)
157
+ rspec-expectations (~> 3.6.0)
158
+ rspec-mocks (~> 3.6.0)
159
+ rspec-support (~> 3.6.0)
160
+ rspec-support (3.6.0)
161
+ sprockets (3.7.1)
162
+ concurrent-ruby (~> 1.0)
163
+ rack (> 1, < 3)
164
+ sprockets-rails (3.2.1)
165
+ actionpack (>= 4.0)
166
+ activesupport (>= 4.0)
167
+ sprockets (>= 3.0.0)
168
+ sqlite3 (1.3.13)
169
+ thor (0.20.0)
170
+ thread_safe (0.3.6)
171
+ tzinfo (1.2.3)
172
+ thread_safe (~> 0.1)
173
+ websocket-driver (0.6.5)
174
+ websocket-extensions (>= 0.1.0)
175
+ websocket-extensions (0.1.2)
176
+ xpath (2.1.0)
177
+ nokogiri (~> 1.3)
178
+
179
+ PLATFORMS
180
+ ruby
181
+
182
+ DEPENDENCIES
183
+ appraisal
184
+ arel!
185
+ capybara (>= 2.2.0)
186
+ database_cleaner (~> 1.2.0)
187
+ doorkeeper!
188
+ doorkeeper-grants_assertion!
189
+ factory_girl
190
+ generator_spec (~> 0.9.0)
191
+ pry
192
+ rails!
193
+ rspec-rails (>= 2.11.4)
194
+ sqlite3
195
+
196
+ BUNDLED WITH
197
+ 1.16.0
@@ -1,8 +1,8 @@
1
- require 'doorkeeper/request/assertion'
1
+ require "doorkeeper/request/assertion"
2
+ require "doorkeeper/grants_assertion/railtie"
2
3
 
3
- # Should belong to Helpers::Controller?
4
4
  module Doorkeeper
5
- class ApplicationController < ActionController::Base
5
+ module GrantsAssertion
6
6
  def resource_owner_from_assertion
7
7
  instance_eval(&Doorkeeper.configuration.resource_owner_from_assertion)
8
8
  end
@@ -20,7 +20,7 @@ end
20
20
  module Doorkeeper
21
21
  class Config
22
22
  option :resource_owner_from_assertion, default: (lambda do |routes|
23
- warn(I18n.translate('doorkeeper.errors.messages.assertion_flow_not_configured'))
23
+ warn(I18n.t("doorkeeper.errors.messages.assertion_flow_not_configured"))
24
24
  nil
25
25
  end)
26
26
  end
@@ -0,0 +1,9 @@
1
+ module Doorkeeper
2
+ module GrantsAssertion
3
+ class Railtie < ::Rails::Railtie
4
+ initializer "doorkeeper.grants_assertion" do
5
+ Doorkeeper::Helpers::Controller.send :include, Doorkeeper::GrantsAssertion
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,29 +1,30 @@
1
1
  module Doorkeeper
2
2
  module Request
3
- class Assertion
4
- def self.build(server)
5
- new(server.credentials, server.resource_owner_from_assertion, server)
6
- end
7
-
8
- attr_accessor :credentials, :resource_owner, :server
9
-
10
- def initialize(credentials, resource_owner, server)
11
- @credentials = credentials
12
- @resource_owner = resource_owner
13
- @server = server
14
- end
3
+ class Assertion < Strategy
4
+ delegate :credentials, :resource_owner_from_assertion, :parameters, to: :server
15
5
 
16
6
  def request
17
7
  @request ||= OAuth::PasswordAccessTokenRequest.new(
18
8
  Doorkeeper.configuration,
19
- credentials,
20
- resource_owner,
21
- server.parameters)
9
+ client,
10
+ resource_owner_from_assertion,
11
+ parameters
12
+ )
22
13
  end
23
14
 
24
15
  def authorize
25
16
  request.authorize
26
17
  end
18
+
19
+ private
20
+
21
+ def client
22
+ if credentials
23
+ server.client
24
+ elsif parameters[:client_id]
25
+ server.client_via_uid
26
+ end
27
+ end
27
28
  end
28
29
  end
29
30
  end
@@ -1,6 +1,5 @@
1
1
  class FullProtectedResourcesController < ApplicationController
2
- doorkeeper_for :index
3
- doorkeeper_for :show, scopes: [:admin]
2
+ before_action :doorkeeper_authorize!
4
3
 
5
4
  def index
6
5
  render text: 'index'
@@ -1,9 +1,9 @@
1
1
  class MetalController < ActionController::Metal
2
2
  include AbstractController::Callbacks
3
3
  include ActionController::Head
4
- include Doorkeeper::Helpers::Filter
4
+ include Doorkeeper::Helpers::Controller
5
5
 
6
- doorkeeper_for :all
6
+ before_action :doorkeeper_authorize!
7
7
 
8
8
  def index
9
9
  self.response_body = { ok: true }.to_json
@@ -1,5 +1,5 @@
1
1
  class SemiProtectedResourcesController < ApplicationController
2
- doorkeeper_for :index
2
+ before_action :doorkeeper_authorize!, only: [:index]
3
3
 
4
4
  def index
5
5
  render text: 'protected index'
@@ -7,9 +7,11 @@ Dummy::Application.configure do
7
7
  # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
- # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_assets = true
12
- config.static_cache_control = 'public, max-age=3600'
10
+ if Rails.version.to_i < 5
11
+ # Configure static asset server for tests with Cache-Control for performance
12
+ config.serve_static_files = true
13
+ config.static_cache_control = 'public, max-age=3600'
14
+ end
13
15
 
14
16
  if Rails.version.to_i < 4
15
17
  # Log error messages when you accidentally call methods on nil
@@ -1,33 +1,78 @@
1
1
  require 'spec_helper_integration'
2
2
 
3
- feature 'Resource Owner Assertion Flow inproperly set up' do
4
- background do
3
+ describe 'Resource Owner Assertion Flow inproperly set up', type: :request do
4
+ before do
5
+ config_is_set(:resource_owner_from_assertion) { nil }
5
6
  client_exists
6
7
  create_resource_owner
7
8
  end
8
9
 
9
10
  context 'with valid user assertion' do
10
- scenario "should not issue new token" do
11
+ it "should not issue new token" do
11
12
  expect {
12
13
  post assertion_endpoint_url(client: @client, resource_owner: @resource_owner)
13
14
  }.to_not change { Doorkeeper::AccessToken.count }
14
15
 
15
- should_have_json 'error', 'invalid_resource_owner'
16
- should_have_json 'error_description', translated_error_message(:invalid_resource_owner)
16
+ should_have_json 'error', 'invalid_grant'
17
+ should_have_json 'error_description', translated_error_message(:invalid_grant)
17
18
  expect(response.status).to eq(401)
18
19
  end
19
20
  end
20
21
  end
21
22
 
22
- feature 'Resource Owner Assertion Flow' do
23
- background do
23
+ describe 'Resource Owner Assertion Flow', type: :request do
24
+ before do
24
25
  config_is_set(:resource_owner_from_assertion) { User.where(assertion: params[:assertion]).first }
25
26
  client_exists
26
27
  create_resource_owner
27
28
  end
28
29
 
30
+ context "with invalid client/application information" do
31
+
32
+ it "should not create an access token" do
33
+ expect {
34
+ post assertion_endpoint_url(
35
+ client_id: 'not-real',
36
+ client_secret: 'not-real',
37
+ redirect_uri: 'http://fake-redirect.com'
38
+ )
39
+ }.to_not change { Doorkeeper::AccessToken.count }
40
+ end
41
+ end
42
+
43
+ context "with missing client/application information" do
44
+ let(:no_client_params) {
45
+ {
46
+ grant_type: "assertion",
47
+ assertion: @resource_owner.assertion
48
+ }
49
+ }
50
+
51
+ it "should create an access token" do
52
+ expect {
53
+ post "/oauth/token?#{build_query(no_client_params)}"
54
+ }.to change { Doorkeeper::AccessToken.count }.by(1)
55
+ end
56
+
57
+ context "when client is required as part of assertion lookup" do
58
+
59
+ before do
60
+ config_is_set(:resource_owner_from_assertion) {
61
+ Doorkeeper::Application.find_by!(uid: params[:client_id])
62
+ User.where(assertion: params[:assertion]).first
63
+ }
64
+ end
65
+
66
+ it "should not create an access token" do
67
+ expect {
68
+ post "/oauth/token?#{build_query(no_client_params)}"
69
+ }.to raise_error(ActiveRecord::RecordNotFound)
70
+ end
71
+ end
72
+ end
73
+
29
74
  context 'with valid user assertion' do
30
- scenario "should issue new token" do
75
+ it "should issue new token" do
31
76
  expect {
32
77
  post assertion_endpoint_url(client: @client, resource_owner: @resource_owner)
33
78
  }.to change { Doorkeeper::AccessToken.count }.by(1)
@@ -37,7 +82,15 @@ feature 'Resource Owner Assertion Flow' do
37
82
  should_have_json 'access_token', token.token
38
83
  end
39
84
 
40
- scenario "should issue a refresh token if enabled" do
85
+ it "should associate the token with the appropriate application" do
86
+ post assertion_endpoint_url(client: @client, resource_owner: @resource_owner)
87
+
88
+ token = Doorkeeper::AccessToken.first
89
+
90
+ expect(token.application_id).to eq(@client.id)
91
+ end
92
+
93
+ it "should issue a refresh token if enabled" do
41
94
  config_is_set(:refresh_token_enabled, true)
42
95
 
43
96
  post assertion_endpoint_url(client: @client, resource_owner: @resource_owner)
@@ -50,23 +103,23 @@ feature 'Resource Owner Assertion Flow' do
50
103
  end
51
104
 
52
105
  context "with invalid user assertion" do
53
- scenario "should not issue new token with bad assertion" do
106
+ it "should not issue new token with bad assertion" do
54
107
  expect {
55
108
  post assertion_endpoint_url( client: @client, assertion: 'i_dont_exist' )
56
109
  }.to_not change { Doorkeeper::AccessToken.count }
57
110
 
58
- should_have_json 'error', 'invalid_resource_owner'
59
- should_have_json 'error_description', translated_error_message(:invalid_resource_owner)
111
+ should_have_json 'error', 'invalid_grant'
112
+ should_have_json 'error_description', translated_error_message(:invalid_grant)
60
113
  expect(response.status).to eq(401)
61
114
  end
62
115
 
63
- scenario "should not issue new token without assertion" do
116
+ it "should not issue new token without assertion" do
64
117
  expect {
65
118
  post assertion_endpoint_url( client: @client )
66
119
  }.to_not change { Doorkeeper::AccessToken.count }
67
120
 
68
- should_have_json 'error', 'invalid_resource_owner'
69
- should_have_json 'error_description', translated_error_message(:invalid_resource_owner)
121
+ should_have_json 'error', 'invalid_grant'
122
+ should_have_json 'error_description', translated_error_message(:invalid_grant)
70
123
  expect(response.status).to eq(401)
71
124
  end
72
125
 
@@ -4,7 +4,6 @@ $LOAD_PATH.unshift File.dirname(__FILE__)
4
4
 
5
5
  require 'dummy/config/environment'
6
6
  require 'rspec/rails'
7
- require 'rspec/autorun'
8
7
  require 'database_cleaner'
9
8
 
10
9
  Rails.logger.info "====> Doorkeeper.orm = #{Doorkeeper.configuration.orm.inspect}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper-grants_assertion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tute Costa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-23 00:00:00.000000000 Z
11
+ date: 2017-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: capybara
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 1.1.2
61
+ version: 2.2.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 1.1.2
68
+ version: 2.2.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: factory_girl
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -116,13 +116,22 @@ extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
118
  - ".gitignore"
119
+ - ".travis.yml"
120
+ - Appraisals
119
121
  - Gemfile
120
122
  - MIT-LICENSE
121
123
  - README.md
122
124
  - Rakefile
123
125
  - config/locales/en.yml
124
126
  - doorkeeper-grants_assertion.gemspec
127
+ - gemfiles/rails_4_2.gemfile
128
+ - gemfiles/rails_4_2.gemfile.lock
129
+ - gemfiles/rails_5_0.gemfile
130
+ - gemfiles/rails_5_0.gemfile.lock
131
+ - gemfiles/rails_latest_and_doorkeeper_latest.gemfile
132
+ - gemfiles/rails_latest_and_doorkeeper_latest.gemfile.lock
125
133
  - lib/doorkeeper/grants_assertion.rb
134
+ - lib/doorkeeper/grants_assertion/railtie.rb
126
135
  - lib/doorkeeper/request/assertion.rb
127
136
  - spec/dummy/Rakefile
128
137
  - spec/dummy/app/controllers/application_controller.rb
@@ -188,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
197
  version: '0'
189
198
  requirements: []
190
199
  rubyforge_project:
191
- rubygems_version: 2.2.2
200
+ rubygems_version: 2.6.13
192
201
  signing_key:
193
202
  specification_version: 4
194
203
  summary: Assertion grant extension for Doorkeeper.