ruby_native 0.2.0 → 0.2.2

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: 0d9d6cb5fdd083374488c8b17293242c7de7ae1e6f9a962f3b114bdcc50c6219
4
- data.tar.gz: fde1679de86ba4b957e9f54fb78af28ebaebf87318c35b4fbc671e992ff4cc6f
3
+ metadata.gz: 6e3d9d2d2971b99d4c25141ff38a61f0ad65473c968b288501e6a37b57468320
4
+ data.tar.gz: c5f615b0d53f72c92dc2b93414c8329eafb6b2d3f358283b7b351091df3f723e
5
5
  SHA512:
6
- metadata.gz: 9193b35728658296fe91a35eaf7595606849755b0273826635e36a596dd2a32ae22ee222753ac95f63cc0c4d0fc8bc3e027e45abc947e683a7cba0e4b4e59a5a
7
- data.tar.gz: dfe50c35e692aef865cc0fcb7d55809fa08a4d6d37b0e3da68bed18b8f8172e742008b5e64afef9f03a643d99a7d2d532b44a762e0bee75f662bbcbb237dcf91
6
+ metadata.gz: 87fcfe5b175f4e858798ed6633f697d30910d11137805a0c8c7e72e3954c1ab3201411e91eac131f5d43a5d0f1dbafea4d94c2d9eb0ae059e2281736f76a4231
7
+ data.tar.gz: a0fad64e8c484e5b146d23db3735fdf863352daaf80fba366fb3b43528d3f987336ad67ec925bdd8057a27250eeb8f20fd1cf82fc51ae3aead2c10d5e7fceba9
@@ -9,6 +9,8 @@ module RubyNative
9
9
  return
10
10
  end
11
11
 
12
+ oauth_paths = RubyNative.config&.dig(:auth, :oauth_paths) || []
13
+ @oauth_path = oauth_paths.find { |p| p.end_with?(@provider) } || "/auth/#{@provider}"
12
14
  @callback_scheme = params[:callback_scheme]
13
15
  end
14
16
  end
@@ -7,7 +7,7 @@
7
7
  </head>
8
8
  <body>
9
9
  <p>Signing in…</p>
10
- <%= form_tag "/auth/#{@provider}", method: :post, id: "oauth-form" do %>
10
+ <%= form_tag @oauth_path, method: :post, id: "oauth-form" do %>
11
11
  <input type="hidden" name="ruby_native" value="1">
12
12
  <input type="hidden" name="callback_scheme" value="<%= @callback_scheme %>">
13
13
  <% end %>
@@ -150,6 +150,8 @@ module RubyNative
150
150
  else []
151
151
  end
152
152
 
153
+ redirect_url = "/" if auth_start_path?(redirect_url)
154
+
153
155
  Rails.logger.info { "[RubyNative] Captured #{cookies.size} cookies for token (raw type: #{raw_cookies.class})" }
154
156
 
155
157
  self.class.build_token(cookies: cookies, redirect_url: redirect_url)
@@ -160,6 +162,13 @@ module RubyNative
160
162
  [302, {"location" => "#{callback_scheme}://auth/callback?#{query}"}, [""]]
161
163
  end
162
164
 
165
+ def auth_start_path?(url)
166
+ path = URI.parse(url).path
167
+ path&.start_with?("/native/auth/start")
168
+ rescue URI::InvalidURIError
169
+ false
170
+ end
171
+
163
172
  def oauth_paths
164
173
  RubyNative.config&.dig(:auth, :oauth_paths) || []
165
174
  end
@@ -1,3 +1,3 @@
1
1
  module RubyNative
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
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.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Masilotti