rodauth-oauth 0.9.0 → 0.9.1

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: ae63d25ed38845cc8186a0484cf7a223f4939b2695d61b58bc2df7d3aec1af0c
4
- data.tar.gz: bb0361efcde688c2dda720825513af035a7befcb36460c11d6d80226e8791bbe
3
+ metadata.gz: 8d0412f0fc70f27a32d2517afbc688eae79304a52fd074298ecac3176edf2ee8
4
+ data.tar.gz: 2bed00e6896786192f3a4b93b145e8b75b0813741b323213586d736745323617
5
5
  SHA512:
6
- metadata.gz: 28a740ca518ec609cfcbffc61fbaa8f71fb049a8221ccb7858b9357b8f4eee9b3fe263b1a2747f1839677f07d05f3a2cf8c2c4370d1ae8c1b3fe4c33d54012c1
7
- data.tar.gz: ad1d38778909f1f7bb8d6e69fbb44177c02eb96c2d40a94e54e0a1221efc871b7fc0e5c364845b38b5a7bb35d33610a9fdcddbb2e95f18be47a6b039f986ed9f
6
+ metadata.gz: d04277337c21a48a9b0504eaadac11342bd69a0892e1ee7bd7114880b35fe1cdf4e086044d8fa6198c82da3b8f49b6e12be58b98316f592ed980733d2c2cdaa7
7
+ data.tar.gz: f3b8ebe3574ff7559c827a42b76ad698b3a33ba93593fe09695a833af92709ca39b33a9e3be0d1c57c6300666de97850810f37e629a29e59bddd0b8746f63f10
@@ -0,0 +1,9 @@
1
+ ### 0.9.1 (08/05/2022)
2
+
3
+ #### Improvements
4
+
5
+ Using `return_response`, introduced in `rodauth` v2.23, which accomplishes better integration with rails response logging mechanism when used under `rodauth-rails`.
6
+
7
+ #### Bugfixes
8
+
9
+ * Fixing namespacing issue which required anyone to have to `require "rodauth-oauth"` before loading it (no need to anymore).
@@ -4,6 +4,8 @@ require "time"
4
4
  require "base64"
5
5
  require "securerandom"
6
6
  require "net/http"
7
+ require "rodauth/version"
8
+ require "rodauth/oauth/version"
7
9
  require "rodauth/oauth/ttl_store"
8
10
  require "rodauth/oauth/database_extensions"
9
11
  require "rodauth/oauth/refinements"
@@ -687,8 +689,7 @@ module Rodauth
687
689
  response["Pragma"] = "no-cache"
688
690
  end
689
691
  json_payload = _json_response_body(body)
690
- response.write(json_payload)
691
- request.halt
692
+ return_response(json_payload)
692
693
  end
693
694
 
694
695
  def throw_json_response_error(status, error_code, message = nil)
@@ -703,8 +704,7 @@ module Rodauth
703
704
  json_payload = _json_response_body(payload)
704
705
  response["Content-Type"] ||= json_response_content_type
705
706
  response["WWW-Authenticate"] = oauth_token_type.upcase if status == 401
706
- response.write(json_payload)
707
- request.halt
707
+ return_response(json_payload)
708
708
  end
709
709
 
710
710
  unless method_defined?(:_json_response_body)
@@ -717,6 +717,13 @@ module Rodauth
717
717
  end
718
718
  end
719
719
 
720
+ if Gem::Version.new(Rodauth.version) < Gem::Version.new("2.23")
721
+ def return_response(body = nil)
722
+ response.write(body) if body
723
+ request.halt
724
+ end
725
+ end
726
+
720
727
  def authorization_required
721
728
  if accepts_json?
722
729
  throw_json_response_error(authorization_required_error_status, "invalid_client")
@@ -714,8 +714,7 @@ module Rodauth
714
714
  response["Cache-Control"] = "no-store"
715
715
  response["Pragma"] = "no-cache"
716
716
  end
717
- response.write(jwt)
718
- request.halt
717
+ return_response(jwt)
719
718
  end
720
719
  end
721
720
  end
@@ -234,8 +234,7 @@ module Rodauth
234
234
  href: authorization_server_url
235
235
  }]
236
236
  })
237
- response.write(json_payload)
238
- request.halt
237
+ return_response(json_payload)
239
238
  end
240
239
  end
241
240
  end
@@ -533,7 +532,7 @@ module Rodauth
533
532
  response["Access-Control-Allow-Methods"] = "GET, OPTIONS"
534
533
  response["Access-Control-Max-Age"] = "3600"
535
534
  response.status = 200
536
- request.halt
535
+ return_response
537
536
  end
538
537
  end
539
538
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rodauth
4
4
  module OAuth
5
- VERSION = "0.9.0"
5
+ VERSION = "0.9.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth-oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-19 00:00:00.000000000 Z
11
+ date: 2022-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rodauth
@@ -57,6 +57,7 @@ extra_rdoc_files:
57
57
  - doc/release_notes/0_7_4.md
58
58
  - doc/release_notes/0_8_0.md
59
59
  - doc/release_notes/0_9_0.md
60
+ - doc/release_notes/0_9_1.md
60
61
  files:
61
62
  - CHANGELOG.md
62
63
  - LICENSE.txt
@@ -85,6 +86,7 @@ files:
85
86
  - doc/release_notes/0_7_4.md
86
87
  - doc/release_notes/0_8_0.md
87
88
  - doc/release_notes/0_9_0.md
89
+ - doc/release_notes/0_9_1.md
88
90
  - lib/generators/rodauth/oauth/install_generator.rb
89
91
  - lib/generators/rodauth/oauth/templates/app/models/oauth_application.rb
90
92
  - lib/generators/rodauth/oauth/templates/app/models/oauth_grant.rb