gatleon-authform-rails 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3ca7bb6cbffefb551a1a745285cb28ad6ba451811565199278b462c899ff2b1
4
- data.tar.gz: 790d1b536bf057cf929b5c7b975d9ecfdfa583477f51c1af15045ad5846ed795
3
+ metadata.gz: 2aad9fabb2346b07e8aa80a03f2e06bdeda6fe6eead9ad8dc72fa9a8a1c0ffe7
4
+ data.tar.gz: 366e08bf5690ec7a6db9156cc663d7355b551a07fa8d8bc2b4703a418e52702f
5
5
  SHA512:
6
- metadata.gz: 6923b17d438ded1ed5fbc8ab8dbe8eecb475b7b760e6a7ed782aa672af8ebbb45cc71b84cfbea3ef49f057dea43a26fc61900e16f4fe2892521f88d96826015d
7
- data.tar.gz: 3b890fb44898fbd97d919a06cd439c1459c31e5e590f23083b6cce3b8c42f2cb94c65c63c33090f9b5738cf398b9398dde831ce56469a9ca3c2a4e78f712136c
6
+ metadata.gz: 9fcbe5be7e43150b8c6f17070dcc8cf2401f6d1883be0ce35bb8f6632aa233f277d81bd3ea3a66c04de28d9893582b50aad4361965923a770b7ddd0819929091
7
+ data.tar.gz: 89c79d90bdcdebbff0944d7a9f7f000407612b72f130bca589f5c80ccaa8677e6eec265a5c473f26df17c7c85a12acdcf8048191f72aeaf9c7c054d1dce17ffb
@@ -0,0 +1 @@
1
+ 2.6.6
data/Gemfile CHANGED
@@ -7,3 +7,4 @@ gem "rake", "~> 12.0"
7
7
  gem "rspec", "~> 3.0"
8
8
  gem "rails"
9
9
  gem "byebug"
10
+ gem "yard"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gatleon-authform-rails (0.1.0)
4
+ gatleon-authform-rails (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -143,6 +143,7 @@ GEM
143
143
  websocket-driver (0.7.1)
144
144
  websocket-extensions (>= 0.1.0)
145
145
  websocket-extensions (0.1.4)
146
+ yard (0.9.24)
146
147
  zeitwerk (2.3.0)
147
148
 
148
149
  PLATFORMS
@@ -154,6 +155,7 @@ DEPENDENCIES
154
155
  rails
155
156
  rake (~> 12.0)
156
157
  rspec (~> 3.0)
158
+ yard
157
159
 
158
160
  BUNDLED WITH
159
161
  2.1.4
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![authform-rails](https://raw.githubusercontent.com/gatleon/gatleon-rails/master/gatleon-authform-rails.png)
1
+ ![authform-rails](https://raw.githubusercontent.com/gatleon/gatleon-authform-rails/master/gatleon-authform-rails.png)
2
2
 
3
3
  # authform-rails by gatleon
4
4
 
@@ -4,6 +4,7 @@ module Gatleon
4
4
  class Concern < Module
5
5
  def initialize(public_key:,
6
6
  secret_key:,
7
+ domain: nil,
7
8
  current_user_method_name: "current_user",
8
9
  _authform_base_url: "https://authform.gatleon.com")
9
10
  super() do
@@ -34,18 +35,7 @@ module Gatleon
34
35
  uri = URI("#{_authform_base_url}/v1/exchangeUserVoucherForUser/#{params[:_authformUserVoucher]}")
35
36
  response = Net::HTTP.get_response(uri)
36
37
 
37
- if response.code.to_i == 200
38
- # First attempt WITHOUT all - for setting on platforms like heroku that deny setting cookies across all subdomains
39
- cookies[_authform_user_cookie_key] = {
40
- value: response.body
41
- }
42
-
43
- # Then set all - desired behavior for hosting your own domain
44
- cookies[_authform_user_cookie_key] = {
45
- value: response.body,
46
- domain: :all
47
- }
48
- end
38
+ cookies[_authform_user_cookie_key] = _cookie_attrs(response.body) if response.code.to_i == 200
49
39
 
50
40
  q = Rack::Utils.parse_query(URI.parse(request.url).query)
51
41
  q.delete("_authformUserVoucher")
@@ -59,6 +49,13 @@ module Gatleon
59
49
  define_method :_authform_user_cookie_key do
60
50
  public_key # allows for multiple forms per site
61
51
  end
52
+
53
+ define_method :_cookie_attrs do |value|
54
+ {
55
+ value: value,
56
+ domain: domain
57
+ }.compact
58
+ end
62
59
  end
63
60
  end
64
61
  end
@@ -1,7 +1,7 @@
1
1
  module Gatleon
2
2
  module Authform
3
3
  module Rails
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gatleon-authform-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - gatleon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-30 00:00:00.000000000 Z
11
+ date: 2020-05-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: add authentication to your application - in 1 minute or less
14
14
  email:
@@ -19,6 +19,7 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - ".gitignore"
21
21
  - ".rspec"
22
+ - ".ruby-version"
22
23
  - ".travis.yml"
23
24
  - Gemfile
24
25
  - Gemfile.lock