ruby_native 0.1.7 → 0.1.8

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: eddde0de797e27e33325a23bffdcbb2e12c0488f4560cfaa0178026ffa0dfcea
4
- data.tar.gz: ec4ac586194bddccedc3cc73093a79a450370d3587ce8f28eff4ecfcf81ec0ec
3
+ metadata.gz: d9b49c97d0f100aa8dc0964d9701187edaa62441f0a1c8d0049233ce8b5fa3c2
4
+ data.tar.gz: b5cce869ec41fda99a9ec98f8b7e930a3b410fadc0103dba4392a75e339ae51b
5
5
  SHA512:
6
- metadata.gz: 45c5cc73aa71badca636536a6442b92c9c06657a039dfd846f960c91b52e9be5ca29c43625b3e245fd0e179780bc0964fe743c4a55088b6debc1a6e76a62d288
7
- data.tar.gz: 27146b84641d802cdb506a44a965f5d4d1274501b25a5611d3ab6af6e950b5ac2ffffd5ad0549d4013f356301280c8a085e37a4c4424eb4c97226f0fee0161cf
6
+ metadata.gz: bd3606567a7f826d197e947c5f059fe25ecd31be3a90f0b04f97c9c694bba417fac707419a7bbc20fe2c40a73d648ef4c35052b834c1ac31c927edcb86f7e996
7
+ data.tar.gz: 6c349b9fa7c260c6b49f2e0af984b7ef8ee1c2bcedf4fb9ce87f1634d7f1fdb0dbc948e698c909a1bdc812603979732b34e760ff470a0e6ac2adfbad67d8c7ca
@@ -8,14 +8,18 @@ module RubyNative
8
8
 
9
9
  def call(env)
10
10
  request = ActionDispatch::Request.new(env)
11
- started_oauth = oauth_start_request?(request)
12
- callback_scheme = request.params["callback_scheme"] if started_oauth
11
+ on_oauth_path = oauth_path?(request)
12
+ started_native_oauth = on_oauth_path && request.params["ruby_native"] == "1"
13
+ callback_scheme = request.params["callback_scheme"] if started_native_oauth
13
14
 
14
15
  status, headers, body = @app.call(env)
15
16
 
16
- if started_oauth && callback_scheme.present? && redirect?(status)
17
- Rails.logger.debug { "[RubyNative] OAuth started for #{request.path}, setting tracking cookie" }
17
+ if on_oauth_path && redirect?(status)
18
18
  relax_cookie_samesite!(headers)
19
+ end
20
+
21
+ if started_native_oauth && callback_scheme.present? && redirect?(status)
22
+ Rails.logger.debug { "[RubyNative] OAuth started for #{request.path}, setting tracking cookie" }
19
23
  set_cookie(headers, callback_scheme)
20
24
  end
21
25
 
@@ -66,9 +70,8 @@ module RubyNative
66
70
 
67
71
  private
68
72
 
69
- def oauth_start_request?(request)
70
- return false unless oauth_paths.any? { |p| request.path == p }
71
- request.params["ruby_native"] == "1"
73
+ def oauth_path?(request)
74
+ oauth_paths.any? { |p| request.path == p }
72
75
  end
73
76
 
74
77
  def set_cookie(headers, callback_scheme)
@@ -1,3 +1,3 @@
1
1
  module RubyNative
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_native
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Masilotti