rodauth-oauth 1.6.4 → 1.6.5

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
  SHA256:
3
- metadata.gz: 83351fdb82b53fcc94fbafcfe1f3a2057b887b633ae39c4de24a5268136164ec
4
- data.tar.gz: 6b1d1f26cfc189cb6d18269af0634f358724a156bd26edc514bb008615e55e68
3
+ metadata.gz: cc6a614c797762b13c8b97dc51abf5191dc09ef919e27fd394f46504b62410c7
4
+ data.tar.gz: 3c6003d4131e03514a5bf8acd674cc1b7d8fcacd9eada7ab98044fc3f037fc95
5
5
  SHA512:
6
- metadata.gz: c2197aad8a6e0d0e5d46ef2b18f0730133d06463c1115c60a949b079849c8bb5ab62e1424db5fea1ede68ae5ff1084dfe805a4247164387163a16f8b5f425c40
7
- data.tar.gz: 63f3c8bfff288028767e833735c8c1496595a9ec08a7c06463df98fe2b93ad987d95e42e0e68c08c24698b97a454924a326d6326c056f41181920c189f04472d
6
+ metadata.gz: 997c1e682fc4f482d0ea367a918c4db15130535294db13f19c52c558f152eca78fd197461d74ce269e77a56b36cf465b8b7e9d2424f3b999cb6491782c8d69f6
7
+ data.tar.gz: 2109d08b8911e33697e08e528899d45535de16c1cc994d663324c51161fed1f6e35386849413adb6dadbb526b2b75c64522865cbdf90798042ca8e68767362cf
@@ -0,0 +1,10 @@
1
+ ### 1.6.5
2
+
3
+ #### Bugfixes
4
+
5
+ * `:oauth_dynamic_client_registration` feature: scoping to the client being updated, preventing thst the resulting database operations touch every row in the `"oauth_applications"` table.
6
+ * `:json` feature: fixed implementation of `json_request?`.
7
+ * `json-jwt` support: set explicit `:skip_verification` parameter when the jwt decoding algorithm is `"none"`.
8
+ * rails generators: add missing uniqueness constraint to the index on the `"issuer"` column of the `"oauth_saml_settings"` table.
9
+ * rails generators: remove the `"jti"` column entry from the `"oauth_dpop_proofs"` table (already made the pkey in the `create_table` instruction).
10
+ * Make `password_hash` method public, which restores compatibility with `rodauth` v2.28 or more recent; `rodauth` **minimum supported version** becomes 2.28.0 as a result, which should not be perceived as a breaking change, as there are no other significant API changes, and ruby version support remains the same.
@@ -136,10 +136,10 @@ class CreateRodauthOauth < ActiveRecord::Migration<%= migration_version %>
136
136
  t.boolean :check_idp_cert_expiration, null: true
137
137
  t.text :name_identifier_format, null: true
138
138
  t.string :audience, null: true
139
- t.string :issuer, null: false, unique: true
139
+ t.string :issuer, null: false, index: { unique: true }
140
140
  end
141
141
 
142
- create_table :oauth_dpop_proofs, primary_key: :jti do |t|
142
+ create_table :oauth_dpop_proofs, id: false, primary_key: :jti do |t|
143
143
  t.string :jti, null: false
144
144
  t.datetime :first_use, null: false, default: -> { "CURRENT_TIMESTAMP(6)" }
145
145
  end
@@ -191,10 +191,10 @@ module Rodauth
191
191
  (accept = request.env["HTTP_ACCEPT"]) && accept =~ json_request_regexp
192
192
  end
193
193
 
194
- # copied from the jwt feature
194
+ # copied from the json feature
195
195
  def json_request?
196
- return super if features.include?(:jsonn)
197
- return @json_request if defined?(@json_request)
196
+ return super if features.include?(:json)
197
+ return @json_request unless @json_request.nil?
198
198
 
199
199
  @json_request = request.content_type =~ json_request_regexp
200
200
  end
@@ -221,13 +221,11 @@ module Rodauth
221
221
  def oauth_application
222
222
  return @oauth_application if defined?(@oauth_application)
223
223
 
224
- @oauth_application = begin
225
- client_id = param_or_nil("client_id")
224
+ client_id = param_or_nil("client_id")
226
225
 
227
- return unless client_id
226
+ return unless client_id
228
227
 
229
- db[oauth_applications_table].filter(oauth_applications_client_id_column => client_id).first
230
- end
228
+ @oauth_application = db[oauth_applications_table].filter(oauth_applications_client_id_column => client_id).first
231
229
  end
232
230
 
233
231
  def fetch_access_token
@@ -309,6 +307,12 @@ module Rodauth
309
307
  self.class.send(:define_method, :__one_oauth_token_per_account) { one_oauth_token_per_account }
310
308
  end
311
309
 
310
+ def password_hash(password)
311
+ return super if features.include?(:login_password_requirements_base)
312
+
313
+ BCrypt::Password.create(password, cost: BCrypt::Engine::DEFAULT_COST)
314
+ end
315
+
312
316
  private
313
317
 
314
318
  def oauth_account_ds(account_id)
@@ -455,12 +459,6 @@ module Rodauth
455
459
  oauth_grant[oauth_grants_oauth_application_id_column] == oauth_application[oauth_applications_id_column]
456
460
  end
457
461
 
458
- def password_hash(password)
459
- return super if features.include?(:login_password_requirements_base)
460
-
461
- BCrypt::Password.create(password, cost: BCrypt::Engine::DEFAULT_COST)
462
- end
463
-
464
462
  def generate_token(grant_params = {}, should_generate_refresh_token = true)
465
463
  if grant_params[oauth_grants_id_column] && oauth_reuse_access_token &&
466
464
  (
@@ -50,6 +50,7 @@ module Rodauth
50
50
 
51
51
  oauth_application = transaction do
52
52
  applications_ds = db[oauth_applications_table]
53
+ .where(oauth_applications_client_id_column => client_id)
53
54
  __update_and_return__(applications_ds, @oauth_application_params)
54
55
  end
55
56
  json_response_oauth_application(oauth_application)
@@ -259,7 +259,7 @@ module Rodauth
259
259
  elsif jws_key
260
260
  JSON::JWT.decode(token, jws_key)
261
261
  else
262
- JSON::JWT.decode(token, nil, jws_algorithm)
262
+ JSON::JWT.decode(token, (:skip_verification if jws_algorithm == "none"), jws_algorithm)
263
263
  end
264
264
  elsif (jwks = auth_server_jwks_set)
265
265
  JSON::JWT.decode(token, JSON::JWK::Set.new(jwks))
@@ -138,21 +138,20 @@ module Rodauth
138
138
  def client_certificate_sans
139
139
  return @client_certificate_sans if defined?(@client_certificate_sans)
140
140
 
141
- @client_certificate_sans = begin
142
- return [] unless client_certificate
143
-
144
- san = client_certificate.extensions.find { |ext| ext.oid == "subjectAltName" }
145
-
146
- return [] unless san
147
-
148
- ostr = OpenSSL::ASN1.decode(san.to_der).value.last
149
-
150
- sans = OpenSSL::ASN1.decode(ostr.value)
151
-
152
- return [] unless sans
153
-
154
- sans.value
155
- end
141
+ @client_certificate_sans =
142
+ if client_certificate
143
+ if (san = client_certificate.extensions.find { |ext| ext.oid == "subjectAltName" })
144
+ ostr = OpenSSL::ASN1.decode(san.to_der).value.last
145
+
146
+ sans = OpenSSL::ASN1.decode(ostr.value)
147
+
148
+ sans ? sans.value : []
149
+ else
150
+ []
151
+ end
152
+ else
153
+ []
154
+ end
156
155
  end
157
156
 
158
157
  def distinguished_name_match?(sub1, sub2)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rodauth
4
4
  module OAuth
5
- VERSION = "1.6.4"
5
+ VERSION = "1.6.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth-oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.4
4
+ version: 1.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
@@ -29,14 +29,14 @@ dependencies:
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '2.0'
32
+ version: '2.28'
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '2.0'
39
+ version: '2.28'
40
40
  description: Implementation of the OAuth 2.0 protocol on top of rodauth.
41
41
  email:
42
42
  - cardoso_tiago@hotmail.com
@@ -92,6 +92,7 @@ extra_rdoc_files:
92
92
  - doc/release_notes/1_6_2.md
93
93
  - doc/release_notes/1_6_3.md
94
94
  - doc/release_notes/1_6_4.md
95
+ - doc/release_notes/1_6_5.md
95
96
  files:
96
97
  - CHANGELOG.md
97
98
  - LICENSE.txt
@@ -142,6 +143,7 @@ files:
142
143
  - doc/release_notes/1_6_2.md
143
144
  - doc/release_notes/1_6_3.md
144
145
  - doc/release_notes/1_6_4.md
146
+ - doc/release_notes/1_6_5.md
145
147
  - lib/generators/rodauth/oauth/install_generator.rb
146
148
  - lib/generators/rodauth/oauth/templates/app/models/oauth_application.rb
147
149
  - lib/generators/rodauth/oauth/templates/app/models/oauth_grant.rb