doorkeeper-openid_connect 1.6.3 → 1.7.4

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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +55 -1
  3. data/README.md +11 -0
  4. data/app/controllers/doorkeeper/authorizations_controller.rb +17 -0
  5. data/app/controllers/doorkeeper/openid_connect/discovery_controller.rb +25 -19
  6. data/app/controllers/doorkeeper/openid_connect/userinfo_controller.rb +5 -1
  7. data/config/locales/en.yml +1 -0
  8. data/lib/doorkeeper/oauth/id_token_request.rb +8 -12
  9. data/lib/doorkeeper/oauth/id_token_response.rb +2 -0
  10. data/lib/doorkeeper/oauth/id_token_token_request.rb +2 -0
  11. data/lib/doorkeeper/oauth/id_token_token_response.rb +2 -0
  12. data/lib/doorkeeper/openid_connect.rb +26 -1
  13. data/lib/doorkeeper/openid_connect/claims/aggregated_claim.rb +2 -0
  14. data/lib/doorkeeper/openid_connect/claims/claim.rb +6 -4
  15. data/lib/doorkeeper/openid_connect/claims/distributed_claim.rb +2 -0
  16. data/lib/doorkeeper/openid_connect/claims/normal_claim.rb +2 -0
  17. data/lib/doorkeeper/openid_connect/claims_builder.rb +3 -1
  18. data/lib/doorkeeper/openid_connect/config.rb +20 -10
  19. data/lib/doorkeeper/openid_connect/engine.rb +2 -0
  20. data/lib/doorkeeper/openid_connect/errors.rb +4 -3
  21. data/lib/doorkeeper/openid_connect/helpers/controller.rb +58 -31
  22. data/lib/doorkeeper/openid_connect/id_token.rb +4 -2
  23. data/lib/doorkeeper/openid_connect/id_token_token.rb +2 -0
  24. data/lib/doorkeeper/openid_connect/oauth/authorization/code.rb +25 -8
  25. data/lib/doorkeeper/openid_connect/oauth/authorization_code_request.rb +4 -2
  26. data/lib/doorkeeper/openid_connect/oauth/password_access_token_request.rb +3 -1
  27. data/lib/doorkeeper/openid_connect/oauth/pre_authorization.rb +24 -3
  28. data/lib/doorkeeper/openid_connect/oauth/token_response.rb +3 -1
  29. data/lib/doorkeeper/openid_connect/orm/active_record.rb +2 -0
  30. data/lib/doorkeeper/openid_connect/orm/active_record/access_grant.rb +3 -1
  31. data/lib/doorkeeper/openid_connect/orm/active_record/request.rb +5 -3
  32. data/lib/doorkeeper/openid_connect/rails/routes.rb +3 -1
  33. data/lib/doorkeeper/openid_connect/rails/routes/mapper.rb +2 -0
  34. data/lib/doorkeeper/openid_connect/rails/routes/mapping.rb +2 -0
  35. data/lib/doorkeeper/openid_connect/response_mode.rb +30 -0
  36. data/lib/doorkeeper/openid_connect/response_types_config.rb +2 -2
  37. data/lib/doorkeeper/openid_connect/user_info.rb +2 -0
  38. data/lib/doorkeeper/openid_connect/version.rb +3 -1
  39. data/lib/doorkeeper/request/id_token.rb +2 -0
  40. data/lib/doorkeeper/request/id_token_token.rb +2 -0
  41. data/lib/generators/doorkeeper/openid_connect/install_generator.rb +4 -2
  42. data/lib/generators/doorkeeper/openid_connect/migration_generator.rb +3 -1
  43. data/lib/generators/doorkeeper/openid_connect/templates/initializer.rb +19 -5
  44. data/lib/generators/doorkeeper/openid_connect/templates/migration.rb.erb +3 -2
  45. metadata +29 -36
  46. data/.gitignore +0 -8
  47. data/.ruby-version +0 -1
  48. data/.travis.yml +0 -34
  49. data/CONTRIBUTING.md +0 -45
  50. data/Gemfile +0 -11
  51. data/Rakefile +0 -24
  52. data/bin/console +0 -9
  53. data/bin/setup +0 -8
  54. data/doorkeeper-openid_connect.gemspec +0 -30
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Doorkeeper
2
4
  module OpenidConnect
3
5
  module ResponseTypeConfig
@@ -12,6 +14,4 @@ module Doorkeeper
12
14
  end
13
15
  end
14
16
  end
15
-
16
- Config.send :prepend, OpenidConnect::ResponseTypeConfig
17
17
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Doorkeeper
2
4
  module OpenidConnect
3
5
  class UserInfo
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Doorkeeper
2
4
  module OpenidConnect
3
- VERSION = '1.6.3'.freeze
5
+ VERSION = '1.7.4'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'doorkeeper/request/strategy'
2
4
 
3
5
  module Doorkeeper
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'doorkeeper/request/strategy'
2
4
 
3
5
  module Doorkeeper
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Doorkeeper
2
4
  module OpenidConnect
3
5
  class InstallGenerator < ::Rails::Generators::Base
4
6
  include ::Rails::Generators::Migration
5
- source_root File.expand_path('../templates', __FILE__)
7
+ source_root File.expand_path('templates', __dir__)
6
8
  desc 'Installs Doorkeeper OpenID Connect.'
7
9
 
8
10
  def install
9
11
  template 'initializer.rb', 'config/initializers/doorkeeper_openid_connect.rb'
10
- copy_file File.expand_path('../../../../../config/locales/en.yml', __FILE__), 'config/locales/doorkeeper_openid_connect.en.yml'
12
+ copy_file File.expand_path('../../../../config/locales/en.yml', __dir__), 'config/locales/doorkeeper_openid_connect.en.yml'
11
13
  route 'use_doorkeeper_openid_connect'
12
14
  end
13
15
  end
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators/active_record'
2
4
 
3
5
  module Doorkeeper
4
6
  module OpenidConnect
5
7
  class MigrationGenerator < ::Rails::Generators::Base
6
8
  include ::Rails::Generators::Migration
7
- source_root File.expand_path('../templates', __FILE__)
9
+ source_root File.expand_path('templates', __dir__)
8
10
  desc 'Installs Doorkeeper OpenID Connect migration file.'
9
11
 
10
12
  def install
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Doorkeeper::OpenidConnect.configure do
2
4
  issuer 'issuer string'
3
5
 
4
- signing_key <<-EOL
5
- -----BEGIN RSA PRIVATE KEY-----
6
- ....
7
- -----END RSA PRIVATE KEY-----
8
- EOL
6
+ signing_key <<~KEY
7
+ -----BEGIN RSA PRIVATE KEY-----
8
+ ....
9
+ -----END RSA PRIVATE KEY-----
10
+ KEY
9
11
 
10
12
  subject_types_supported [:public]
11
13
 
@@ -26,6 +28,18 @@ EOL
26
28
  # redirect_to new_user_session_url
27
29
  end
28
30
 
31
+ # Depending on your configuration, a DoubleRenderError could be raised
32
+ # if render/redirect_to is called at some point before this callback is executed.
33
+ # To avoid the DoubleRenderError, you could add these two lines at the beginning
34
+ # of this callback: (Reference: https://github.com/rails/rails/issues/25106)
35
+ # self.response_body = nil
36
+ # @_response_body = nil
37
+ select_account_for_resource_owner do |resource_owner, return_to|
38
+ # Example implementation:
39
+ # store_location_for resource_owner, return_to
40
+ # redirect_to account_select_url
41
+ end
42
+
29
43
  subject do |resource_owner, application|
30
44
  # Example implementation:
31
45
  # resource_owner.id
@@ -1,14 +1,15 @@
1
1
  class CreateDoorkeeperOpenidConnectTables < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :oauth_openid_requests do |t|
4
- t.integer :access_grant_id, null: false
4
+ t.references :access_grant, null: false, index: true
5
5
  t.string :nonce, null: false
6
6
  end
7
7
 
8
8
  add_foreign_key(
9
9
  :oauth_openid_requests,
10
10
  :oauth_access_grants,
11
- column: :access_grant_id
11
+ column: :access_grant_id,
12
+ on_delete: :cascade
12
13
  )
13
14
  end
14
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper-openid_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Dengler
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-09-24 00:00:00.000000000 Z
12
+ date: 2020-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: doorkeeper
@@ -17,48 +17,48 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '5.0'
20
+ version: '5.2'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '5.2'
23
+ version: '5.5'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- version: '5.0'
30
+ version: '5.2'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.2'
33
+ version: '5.5'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: json-jwt
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.6'
40
+ version: 1.11.0
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.6'
47
+ version: 1.11.0
48
48
  - !ruby/object:Gem::Dependency
49
- name: rspec-rails
49
+ name: conventional-changelog
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '1.2'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.2'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: factory_bot
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -74,21 +74,21 @@ dependencies:
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  - !ruby/object:Gem::Dependency
77
- name: sqlite3
77
+ name: pry-byebug
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 1.3.6
82
+ version: '0'
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 1.3.6
89
+ version: '0'
90
90
  - !ruby/object:Gem::Dependency
91
- name: pry-byebug
91
+ name: rspec-rails
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
@@ -102,19 +102,19 @@ dependencies:
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  - !ruby/object:Gem::Dependency
105
- name: conventional-changelog
105
+ name: sqlite3
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '1.2'
110
+ version: 1.3.6
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '1.2'
117
+ version: 1.3.6
118
118
  description: OpenID Connect extension for Doorkeeper.
119
119
  email:
120
120
  - sam.dengler@playonsports.com
@@ -123,21 +123,13 @@ executables: []
123
123
  extensions: []
124
124
  extra_rdoc_files: []
125
125
  files:
126
- - ".gitignore"
127
- - ".ruby-version"
128
- - ".travis.yml"
129
126
  - CHANGELOG.md
130
- - CONTRIBUTING.md
131
- - Gemfile
132
127
  - LICENSE.txt
133
128
  - README.md
134
- - Rakefile
129
+ - app/controllers/doorkeeper/authorizations_controller.rb
135
130
  - app/controllers/doorkeeper/openid_connect/discovery_controller.rb
136
131
  - app/controllers/doorkeeper/openid_connect/userinfo_controller.rb
137
- - bin/console
138
- - bin/setup
139
132
  - config/locales/en.yml
140
- - doorkeeper-openid_connect.gemspec
141
133
  - lib/doorkeeper/oauth/id_token_request.rb
142
134
  - lib/doorkeeper/oauth/id_token_response.rb
143
135
  - lib/doorkeeper/oauth/id_token_token_request.rb
@@ -165,6 +157,7 @@ files:
165
157
  - lib/doorkeeper/openid_connect/rails/routes.rb
166
158
  - lib/doorkeeper/openid_connect/rails/routes/mapper.rb
167
159
  - lib/doorkeeper/openid_connect/rails/routes/mapping.rb
160
+ - lib/doorkeeper/openid_connect/response_mode.rb
168
161
  - lib/doorkeeper/openid_connect/response_types_config.rb
169
162
  - lib/doorkeeper/openid_connect/user_info.rb
170
163
  - lib/doorkeeper/openid_connect/version.rb
@@ -186,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
179
  requirements:
187
180
  - - ">="
188
181
  - !ruby/object:Gem::Version
189
- version: '2.3'
182
+ version: '2.4'
190
183
  required_rubygems_version: !ruby/object:Gem::Requirement
191
184
  requirements:
192
185
  - - ">="
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- /.bundle
2
- /Gemfile.lock
3
- /spec/dummy/db/*.sqlite3*
4
- /spec/dummy/db/migrate/*doorkeeper_openid_connect*
5
- /spec/dummy/log/*.log
6
- /spec/dummy/tmp/
7
- /spec/examples.txt
8
- /pkg
@@ -1 +0,0 @@
1
- 2.6.3
@@ -1,34 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- sudo: false
4
-
5
- before_install:
6
- - gem update --system
7
- # Bundler 2.0 is not compatible with Rails 4.2
8
- # https://docs.travis-ci.com/user/languages/ruby/#bundler-20
9
- - "find /home/travis/.rvm/rubies -wholename '*default/bundler-*.gemspec' -delete"
10
- - rvm @global do gem uninstall bundler -a -x -I || true
11
- - gem install bundler -v '< 2'
12
-
13
- before_script:
14
- - bundle update
15
- - bundle exec rake migrate
16
-
17
- script:
18
- - bundle exec rake spec
19
-
20
- env:
21
- - rails=4.2.0
22
- - rails=5.0.0
23
- - rails=5.2.0
24
-
25
- rvm:
26
- - 2.3
27
- - 2.4
28
- - 2.5
29
- - 2.6
30
-
31
- matrix:
32
- exclude:
33
- - env: rails=4.2.0
34
- rvm: 2.6
@@ -1,45 +0,0 @@
1
- # Contributing
2
-
3
- ## Workflow
4
-
5
- We are using the [Feature Branch Workflow (also known as GitHub Flow)](https://guides.github.com/introduction/flow/), and prefer delivery as pull requests.
6
-
7
- Our first line of defense is the [Travis CI](https://travis-ci.org/doorkeeper-gem/doorkeeper-openid_connect) build defined within [.travis.yml](.travis.yml) and triggered for every pull request.
8
-
9
- Create a feature branch:
10
-
11
- ```sh
12
- git checkout -B feature/contributing
13
- ```
14
-
15
- ## Creating Good Commits
16
-
17
- The cardinal rule for creating good commits is to ensure there is only one
18
- "logical change" per commit. Why is this an important rule?
19
-
20
- * The smaller the amount of code being changed, the quicker & easier it is to
21
- review & identify potential flaws.
22
-
23
- * If a change is found to be flawed later, it may be necessary to revert the
24
- broken commit. This is much easier to do if there are not other unrelated
25
- code changes entangled with the original commit.
26
-
27
- * When troubleshooting problems using Git's bisect capability, small well
28
- defined changes will aid in isolating exactly where the code problem was
29
- introduced.
30
-
31
- * When browsing history using Git annotate/blame, small well defined changes
32
- also aid in isolating exactly where & why a piece of code came from.
33
-
34
- Things to avoid when creating commits:
35
-
36
- * Mixing whitespace changes with functional code changes.
37
- * Mixing two unrelated functional changes.
38
- * Sending large new features in a single giant commit.
39
-
40
- ## Release process
41
-
42
- - Bump version in `lib/doorkeeper/openid_connect/version.rb`
43
- - Update `CHANGELOG.md`
44
- - Commit all changes
45
- - Tag release and publish gem with `rake release`
data/Gemfile DELETED
@@ -1,11 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # use Rails version specified by environment
4
- ENV['rails'] ||= '5.2.0'
5
- gem 'rails', "~> #{ENV['rails']}"
6
-
7
- if ENV['rails'] =~ /^5./
8
- gem 'rails-controller-testing'
9
- end
10
-
11
- gemspec
data/Rakefile DELETED
@@ -1,24 +0,0 @@
1
- ENV['RAILS_ENV'] ||= 'test'
2
-
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
-
6
- RSpec::Core::RakeTask.new
7
-
8
- task default: :spec
9
- task test: :spec
10
-
11
- desc 'Generate and run migrations in the test application'
12
- task :migrate do
13
- Dir.chdir('spec/dummy') do
14
- system('bin/rails generate doorkeeper:openid_connect:migration')
15
- system('bin/rake db:migrate')
16
- end
17
- end
18
-
19
- desc 'Run server in the test application'
20
- task :server do
21
- Dir.chdir('spec/dummy') do
22
- system('bin/rails server')
23
- end
24
- end
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- Bundler.require :default
5
-
6
- require 'doorkeeper/openid_connect'
7
-
8
- require 'pry'
9
- Pry.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here