shopify_app 18.1.2 → 19.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +2 -2
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +18 -0
  5. data/Gemfile +3 -2
  6. data/Gemfile.lock +120 -134
  7. data/Rakefile +4 -3
  8. data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +1 -1
  9. data/app/controllers/shopify_app/authenticated_controller.rb +1 -0
  10. data/app/controllers/shopify_app/callback_controller.rb +46 -133
  11. data/app/controllers/shopify_app/sessions_controller.rb +25 -137
  12. data/app/controllers/shopify_app/webhooks_controller.rb +5 -23
  13. data/config/routes.rb +6 -12
  14. data/docs/Troubleshooting.md +0 -3
  15. data/docs/Upgrading.md +87 -5
  16. data/docs/shopify_app/webhooks.md +1 -1
  17. data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +10 -9
  18. data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -0
  19. data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +4 -3
  20. data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +13 -12
  21. data/lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt +9 -1
  22. data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +7 -6
  23. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +2 -1
  24. data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +1 -1
  25. data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb +3 -3
  26. data/lib/generators/shopify_app/controllers/controllers_generator.rb +4 -3
  27. data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +11 -15
  28. data/lib/generators/shopify_app/home_controller/templates/home_controller.rb +2 -2
  29. data/lib/generators/shopify_app/home_controller/templates/index.html.erb +3 -3
  30. data/lib/generators/shopify_app/install/install_generator.rb +25 -74
  31. data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +1 -1
  32. data/lib/generators/shopify_app/install/templates/session_store.rb +2 -1
  33. data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +20 -5
  34. data/lib/generators/shopify_app/products_controller/products_controller_generator.rb +3 -3
  35. data/lib/generators/shopify_app/products_controller/templates/products_controller.rb +1 -1
  36. data/lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb +4 -4
  37. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token.rake +1 -0
  38. data/lib/generators/shopify_app/rotate_shopify_token_job/templates/rotate_shopify_token_job.rb +1 -1
  39. data/lib/generators/shopify_app/routes/routes_generator.rb +6 -5
  40. data/lib/generators/shopify_app/routes/templates/routes.rb +5 -5
  41. data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +11 -10
  42. data/lib/generators/shopify_app/shop_model/templates/shop.rb +1 -0
  43. data/lib/generators/shopify_app/shopify_app_generator.rb +4 -3
  44. data/lib/generators/shopify_app/user_model/templates/user.rb +1 -0
  45. data/lib/generators/shopify_app/user_model/user_model_generator.rb +11 -10
  46. data/lib/generators/shopify_app/views/views_generator.rb +4 -3
  47. data/lib/shopify_app/access_scopes/shop_strategy.rb +2 -2
  48. data/lib/shopify_app/access_scopes/user_strategy.rb +4 -4
  49. data/lib/shopify_app/configuration.rb +5 -17
  50. data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +4 -3
  51. data/lib/shopify_app/controller_concerns/csrf_protection.rb +2 -1
  52. data/lib/shopify_app/controller_concerns/embedded_app.rb +4 -3
  53. data/lib/shopify_app/controller_concerns/itp.rb +3 -3
  54. data/lib/shopify_app/controller_concerns/localization.rb +1 -0
  55. data/lib/shopify_app/controller_concerns/login_protection.rb +56 -70
  56. data/lib/shopify_app/controller_concerns/payload_verification.rb +3 -2
  57. data/lib/shopify_app/controller_concerns/webhook_verification.rb +2 -1
  58. data/lib/shopify_app/engine.rb +7 -15
  59. data/lib/shopify_app/jobs/scripttags_manager_job.rb +2 -2
  60. data/lib/shopify_app/jobs/webhooks_manager_job.rb +4 -5
  61. data/lib/shopify_app/managers/scripttags_manager.rb +11 -4
  62. data/lib/shopify_app/managers/webhooks_manager.rb +42 -44
  63. data/lib/shopify_app/middleware/jwt_middleware.rb +5 -4
  64. data/lib/shopify_app/session/in_memory_session_store.rb +1 -0
  65. data/lib/shopify_app/session/in_memory_shop_session_store.rb +2 -1
  66. data/lib/shopify_app/session/in_memory_user_session_store.rb +1 -0
  67. data/lib/shopify_app/session/jwt.rb +9 -8
  68. data/lib/shopify_app/session/null_user_session_store.rb +2 -1
  69. data/lib/shopify_app/session/session_repository.rb +37 -0
  70. data/lib/shopify_app/session/session_storage.rb +4 -6
  71. data/lib/shopify_app/session/shop_session_storage.rb +6 -6
  72. data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +7 -8
  73. data/lib/shopify_app/session/user_session_storage.rb +19 -6
  74. data/lib/shopify_app/session/user_session_storage_with_scopes.rb +22 -9
  75. data/lib/shopify_app/test_helpers/all.rb +2 -1
  76. data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +4 -3
  77. data/lib/shopify_app/utils.rb +2 -9
  78. data/lib/shopify_app/version.rb +2 -1
  79. data/lib/shopify_app.rb +35 -40
  80. data/package.json +1 -1
  81. data/shopify_app.gemspec +21 -20
  82. data/yarn.lock +9 -9
  83. metadata +43 -48
  84. data/lib/generators/shopify_app/install/templates/omniauth.rb +0 -4
  85. data/lib/generators/shopify_app/install/templates/shopify_provider.rb.tt +0 -8
  86. data/lib/generators/shopify_app/install/templates/user_agent.rb +0 -6
  87. data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +0 -34
  88. data/lib/shopify_app/omniauth/omniauth_configuration.rb +0 -64
data/lib/shopify_app.rb CHANGED
@@ -1,11 +1,10 @@
1
1
  # frozen_string_literal: true
2
- require 'shopify_app/version'
2
+
3
+ require "shopify_app/version"
3
4
 
4
5
  # deps
5
- require 'shopify_api'
6
- require 'omniauth/rails_csrf_protection'
7
- require 'omniauth-shopify-oauth2'
8
- require 'redirect_safely'
6
+ require "shopify_api"
7
+ require "redirect_safely"
9
8
 
10
9
  module ShopifyApp
11
10
  def self.rails6?
@@ -22,59 +21,55 @@ module ShopifyApp
22
21
 
23
22
  def self.use_webpacker?
24
23
  rails6? &&
25
- defined?(Webpacker) == 'constant' &&
24
+ defined?(Webpacker) == "constant" &&
26
25
  !configuration.disable_webpacker
27
26
  end
28
27
 
29
28
  # config
30
- require 'shopify_app/configuration'
29
+ require "shopify_app/configuration"
31
30
 
32
31
  # engine
33
- require 'shopify_app/engine'
32
+ require "shopify_app/engine"
34
33
 
35
34
  # utils
36
- require 'shopify_app/utils'
35
+ require "shopify_app/utils"
37
36
 
38
37
  # controller concerns
39
- require 'shopify_app/controller_concerns/csrf_protection'
40
- require 'shopify_app/controller_concerns/localization'
41
- require 'shopify_app/controller_concerns/itp'
42
- require 'shopify_app/controller_concerns/login_protection'
43
- require 'shopify_app/controller_concerns/embedded_app'
44
- require 'shopify_app/controller_concerns/payload_verification'
45
- require 'shopify_app/controller_concerns/app_proxy_verification'
46
- require 'shopify_app/controller_concerns/webhook_verification'
38
+ require "shopify_app/controller_concerns/csrf_protection"
39
+ require "shopify_app/controller_concerns/localization"
40
+ require "shopify_app/controller_concerns/itp"
41
+ require "shopify_app/controller_concerns/login_protection"
42
+ require "shopify_app/controller_concerns/embedded_app"
43
+ require "shopify_app/controller_concerns/payload_verification"
44
+ require "shopify_app/controller_concerns/app_proxy_verification"
45
+ require "shopify_app/controller_concerns/webhook_verification"
47
46
 
48
47
  # jobs
49
- require 'shopify_app/jobs/webhooks_manager_job'
50
- require 'shopify_app/jobs/scripttags_manager_job'
48
+ require "shopify_app/jobs/webhooks_manager_job"
49
+ require "shopify_app/jobs/scripttags_manager_job"
51
50
 
52
51
  # managers
53
- require 'shopify_app/managers/webhooks_manager'
54
- require 'shopify_app/managers/scripttags_manager'
52
+ require "shopify_app/managers/webhooks_manager"
53
+ require "shopify_app/managers/scripttags_manager"
55
54
 
56
55
  # middleware
57
- require 'shopify_app/middleware/jwt_middleware'
58
- require 'shopify_app/middleware/same_site_cookie_middleware'
56
+ require "shopify_app/middleware/jwt_middleware"
59
57
 
60
58
  # session
61
- require 'shopify_app/session/in_memory_session_store'
62
- require 'shopify_app/session/in_memory_shop_session_store'
63
- require 'shopify_app/session/in_memory_user_session_store'
64
- require 'shopify_app/session/jwt'
65
- require 'shopify_app/session/null_user_session_store'
66
- require 'shopify_app/session/session_repository'
67
- require 'shopify_app/session/session_storage'
68
- require 'shopify_app/session/shop_session_storage'
69
- require 'shopify_app/session/shop_session_storage_with_scopes'
70
- require 'shopify_app/session/user_session_storage'
71
- require 'shopify_app/session/user_session_storage_with_scopes'
59
+ require "shopify_app/session/in_memory_session_store"
60
+ require "shopify_app/session/in_memory_shop_session_store"
61
+ require "shopify_app/session/in_memory_user_session_store"
62
+ require "shopify_app/session/jwt"
63
+ require "shopify_app/session/null_user_session_store"
64
+ require "shopify_app/session/session_repository"
65
+ require "shopify_app/session/session_storage"
66
+ require "shopify_app/session/shop_session_storage"
67
+ require "shopify_app/session/shop_session_storage_with_scopes"
68
+ require "shopify_app/session/user_session_storage"
69
+ require "shopify_app/session/user_session_storage_with_scopes"
72
70
 
73
71
  # access scopes strategies
74
- require 'shopify_app/access_scopes/shop_strategy'
75
- require 'shopify_app/access_scopes/user_strategy'
76
- require 'shopify_app/access_scopes/noop_strategy'
77
-
78
- # omniauth_configuration
79
- require 'shopify_app/omniauth/omniauth_configuration'
72
+ require "shopify_app/access_scopes/shop_strategy"
73
+ require "shopify_app/access_scopes/user_strategy"
74
+ require "shopify_app/access_scopes/noop_strategy"
80
75
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopify_app",
3
- "version": "18.1.2",
3
+ "version": "19.0.1",
4
4
  "repository": "git@github.com:Shopify/shopify_app.git",
5
5
  "author": "Shopify",
6
6
  "license": "MIT",
data/shopify_app.gemspec CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
- $LOAD_PATH.push(File.expand_path('../lib', __FILE__))
2
+
3
+ $LOAD_PATH.push(File.expand_path("../lib", __FILE__))
3
4
  require "shopify_app/version"
4
5
 
5
6
  Gem::Specification.new do |s|
@@ -7,30 +8,30 @@ Gem::Specification.new do |s|
7
8
  s.version = ShopifyApp::VERSION
8
9
  s.platform = Gem::Platform::RUBY
9
10
  s.author = "Shopify"
10
- s.summary = 'This gem is used to get quickly started with the Shopify API'
11
+ s.summary = "This gem is used to get quickly started with the Shopify API"
11
12
 
12
13
  s.required_ruby_version = ">= 2.6"
13
14
 
14
- s.metadata['allowed_push_host'] = 'https://rubygems.org'
15
+ s.metadata["allowed_push_host"] = "https://rubygems.org"
15
16
 
16
- s.add_runtime_dependency('browser_sniffer', '~> 1.4.0')
17
- s.add_runtime_dependency('omniauth-rails_csrf_protection')
18
- s.add_runtime_dependency('rails', '> 5.2.1')
19
- s.add_runtime_dependency('shopify_api', '~> 9.4')
20
- s.add_runtime_dependency('omniauth-shopify-oauth2', '~> 2.3')
21
- s.add_runtime_dependency('jwt', '>= 2.2.3')
22
- s.add_runtime_dependency('redirect_safely', '~> 1.0')
17
+ s.add_runtime_dependency("activeresource") # TODO: Remove this once all active resource dependencies are removed
18
+ s.add_runtime_dependency("browser_sniffer", "~> 1.4.0")
19
+ s.add_runtime_dependency("jwt", ">= 2.2.3")
20
+ s.add_runtime_dependency("rails", "> 5.2.1")
21
+ s.add_runtime_dependency("redirect_safely", "~> 1.0")
22
+ s.add_runtime_dependency("shopify_api", "~> 10.0")
23
+ s.add_runtime_dependency("sprockets-rails", ">= 2.0.0")
23
24
 
24
- s.add_development_dependency('rake')
25
- s.add_development_dependency('byebug')
26
- s.add_development_dependency('pry')
27
- s.add_development_dependency('pry-nav')
28
- s.add_development_dependency('pry-stack_explorer')
29
- s.add_development_dependency('rb-readline')
30
- s.add_development_dependency('sqlite3', '~> 1.4')
31
- s.add_development_dependency('minitest')
32
- s.add_development_dependency('mocha')
33
- s.add_development_dependency('webmock')
25
+ s.add_development_dependency("byebug")
26
+ s.add_development_dependency("minitest")
27
+ s.add_development_dependency("mocha")
28
+ s.add_development_dependency("pry")
29
+ s.add_development_dependency("pry-nav")
30
+ s.add_development_dependency("pry-stack_explorer")
31
+ s.add_development_dependency("rake")
32
+ s.add_development_dependency("rb-readline")
33
+ s.add_development_dependency("sqlite3", "~> 1.4")
34
+ s.add_development_dependency("webmock")
34
35
 
35
36
  s.files = %x(git ls-files).split("\n").reject { |f| f.match(%r{^(test|example)/}) }
36
37
  s.test_files = %x(git ls-files -- {test}/*).split("\n")
data/yarn.lock CHANGED
@@ -2555,9 +2555,9 @@ flush-write-stream@^1.0.0:
2555
2555
  readable-stream "^2.3.6"
2556
2556
 
2557
2557
  follow-redirects@^1.0.0:
2558
- version "1.14.7"
2559
- resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685"
2560
- integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==
2558
+ version "1.14.9"
2559
+ resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7"
2560
+ integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==
2561
2561
 
2562
2562
  for-in@^1.0.2:
2563
2563
  version "1.0.2"
@@ -3515,9 +3515,9 @@ minimatch@3.0.4, minimatch@^3.0.4:
3515
3515
  brace-expansion "^1.1.7"
3516
3516
 
3517
3517
  minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5:
3518
- version "1.2.5"
3519
- resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
3520
- integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
3518
+ version "1.2.6"
3519
+ resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
3520
+ integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
3521
3521
 
3522
3522
  mississippi@^3.0.0:
3523
3523
  version "3.0.0"
@@ -3892,9 +3892,9 @@ path-to-regexp@^1.7.0:
3892
3892
  isarray "0.0.1"
3893
3893
 
3894
3894
  pathval@^1.1.0:
3895
- version "1.1.0"
3896
- resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0"
3897
- integrity sha1-uULm1L3mUwBe9rcTYd74cn0GReA=
3895
+ version "1.1.1"
3896
+ resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d"
3897
+ integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==
3898
3898
 
3899
3899
  pbkdf2@^3.0.3:
3900
3900
  version "3.1.1"
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 18.1.2
4
+ version: 19.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-03 00:00:00.000000000 Z
11
+ date: 2022-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activeresource
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: browser_sniffer
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -25,19 +39,19 @@ dependencies:
25
39
  - !ruby/object:Gem::Version
26
40
  version: 1.4.0
27
41
  - !ruby/object:Gem::Dependency
28
- name: omniauth-rails_csrf_protection
42
+ name: jwt
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: '0'
47
+ version: 2.2.3
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: '0'
54
+ version: 2.2.3
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rails
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -53,63 +67,63 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: 5.2.1
55
69
  - !ruby/object:Gem::Dependency
56
- name: shopify_api
70
+ name: redirect_safely
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '9.4'
75
+ version: '1.0'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '9.4'
82
+ version: '1.0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: omniauth-shopify-oauth2
84
+ name: shopify_api
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '2.3'
89
+ version: '10.0'
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '2.3'
96
+ version: '10.0'
83
97
  - !ruby/object:Gem::Dependency
84
- name: jwt
98
+ name: sprockets-rails
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: 2.2.3
103
+ version: 2.0.0
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: 2.2.3
110
+ version: 2.0.0
97
111
  - !ruby/object:Gem::Dependency
98
- name: redirect_safely
112
+ name: byebug
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - "~>"
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
- version: '1.0'
104
- type: :runtime
117
+ version: '0'
118
+ type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - "~>"
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
- version: '1.0'
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: rake
126
+ name: minitest
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
@@ -123,7 +137,7 @@ dependencies:
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
- name: byebug
140
+ name: mocha
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - ">="
@@ -179,7 +193,7 @@ dependencies:
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
- name: rb-readline
196
+ name: rake
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
199
  - - ">="
@@ -193,21 +207,7 @@ dependencies:
193
207
  - !ruby/object:Gem::Version
194
208
  version: '0'
195
209
  - !ruby/object:Gem::Dependency
196
- name: sqlite3
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - "~>"
200
- - !ruby/object:Gem::Version
201
- version: '1.4'
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - "~>"
207
- - !ruby/object:Gem::Version
208
- version: '1.4'
209
- - !ruby/object:Gem::Dependency
210
- name: minitest
210
+ name: rb-readline
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - ">="
@@ -221,19 +221,19 @@ dependencies:
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0'
223
223
  - !ruby/object:Gem::Dependency
224
- name: mocha
224
+ name: sqlite3
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
- - - ">="
227
+ - - "~>"
228
228
  - !ruby/object:Gem::Version
229
- version: '0'
229
+ version: '1.4'
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
- - - ">="
234
+ - - "~>"
235
235
  - !ruby/object:Gem::Version
236
- version: '0'
236
+ version: '1.4'
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: webmock
239
239
  requirement: !ruby/object:Gem::Requirement
@@ -367,14 +367,11 @@ files:
367
367
  - lib/generators/shopify_app/install/templates/_flash_messages.html.erb
368
368
  - lib/generators/shopify_app/install/templates/embedded_app.html.erb
369
369
  - lib/generators/shopify_app/install/templates/flash_messages.js
370
- - lib/generators/shopify_app/install/templates/omniauth.rb
371
370
  - lib/generators/shopify_app/install/templates/session_store.rb
372
371
  - lib/generators/shopify_app/install/templates/shopify_app.js
373
372
  - lib/generators/shopify_app/install/templates/shopify_app.rb.tt
374
373
  - lib/generators/shopify_app/install/templates/shopify_app_importmap.js
375
374
  - lib/generators/shopify_app/install/templates/shopify_app_index.js
376
- - lib/generators/shopify_app/install/templates/shopify_provider.rb.tt
377
- - lib/generators/shopify_app/install/templates/user_agent.rb
378
375
  - lib/generators/shopify_app/products_controller/products_controller_generator.rb
379
376
  - lib/generators/shopify_app/products_controller/templates/products_controller.rb
380
377
  - lib/generators/shopify_app/rotate_shopify_token_job/rotate_shopify_token_job_generator.rb
@@ -413,8 +410,6 @@ files:
413
410
  - lib/shopify_app/managers/scripttags_manager.rb
414
411
  - lib/shopify_app/managers/webhooks_manager.rb
415
412
  - lib/shopify_app/middleware/jwt_middleware.rb
416
- - lib/shopify_app/middleware/same_site_cookie_middleware.rb
417
- - lib/shopify_app/omniauth/omniauth_configuration.rb
418
413
  - lib/shopify_app/session/in_memory_session_store.rb
419
414
  - lib/shopify_app/session/in_memory_shop_session_store.rb
420
415
  - lib/shopify_app/session/in_memory_user_session_store.rb
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Rails.application.config.middleware.use(OmniAuth::Builder) do
4
- end
@@ -1,8 +0,0 @@
1
- provider :shopify,
2
- ShopifyApp.configuration.api_key,
3
- ShopifyApp.configuration.secret,
4
- scope: ShopifyApp.configuration.scope,
5
- setup: lambda { |env|
6
- configuration = ShopifyApp::OmniAuthConfiguration.new(env['omniauth.strategy'], Rack::Request.new(env))
7
- configuration.build_options
8
- }
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
- module ShopifyAPI
3
- class Base < ActiveResource::Base
4
- headers['User-Agent'] << " | ShopifyApp/#{ShopifyApp::VERSION}"
5
- end
6
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
- module ShopifyApp
3
- class SameSiteCookieMiddleware
4
- COOKIE_SEPARATOR = "\n"
5
-
6
- def initialize(app)
7
- @app = app
8
- end
9
-
10
- def call(env)
11
- status, headers, body = @app.call(env)
12
- user_agent = env['HTTP_USER_AGENT']
13
-
14
- if headers && headers['Set-Cookie'] &&
15
- BrowserSniffer.new(user_agent).same_site_none_compatible? &&
16
- ShopifyApp.configuration.enable_same_site_none &&
17
- Rack::Request.new(env).ssl?
18
-
19
- set_cookies = headers['Set-Cookie']
20
- .split(COOKIE_SEPARATOR)
21
- .compact
22
- .map do |cookie|
23
- cookie << '; Secure' unless cookie =~ /;\s*secure/i
24
- cookie << '; SameSite=None' if ShopifyApp.configuration.embedded_app?
25
- cookie
26
- end
27
-
28
- headers['Set-Cookie'] = set_cookies.join(COOKIE_SEPARATOR)
29
- end
30
-
31
- [status, headers, body]
32
- end
33
- end
34
- end
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ShopifyApp
4
- class OmniAuthConfiguration
5
- attr_reader :strategy, :request
6
- attr_writer :client_options_site, :scopes, :per_user_permissions
7
-
8
- def initialize(strategy, request)
9
- @strategy = strategy
10
- @request = request
11
- end
12
-
13
- def build_options
14
- strategy.options[:client_options][:site] = client_options_site
15
- strategy.options[:scope] = scopes
16
- strategy.options[:old_client_secret] = ShopifyApp.configuration.old_secret
17
- strategy.options[:per_user_permissions] = request_online_tokens?
18
- end
19
-
20
- private
21
-
22
- def request_online_tokens?
23
- return @per_user_permissions unless @per_user_permissions.nil?
24
- default_request_online_tokens?
25
- end
26
-
27
- def scopes
28
- @scopes || default_scopes
29
- end
30
-
31
- def client_options_site
32
- @client_options_site || default_client_options_site
33
- end
34
-
35
- def default_scopes
36
- if request_online_tokens?
37
- ShopifyApp.configuration.user_access_scopes
38
- else
39
- ShopifyApp.configuration.shop_access_scopes
40
- end
41
- end
42
-
43
- def default_client_options_site
44
- return '' unless shop_domain.present?
45
- "https://#{shopify_auth_params[:shop]}"
46
- end
47
-
48
- def default_request_online_tokens?
49
- strategy.session[:user_tokens] && !update_shop_scopes?
50
- end
51
-
52
- def update_shop_scopes?
53
- ShopifyApp.configuration.shop_access_scopes_strategy.update_access_scopes?(shop_domain)
54
- end
55
-
56
- def shop_domain
57
- request.params['shop'] || (shopify_auth_params && shopify_auth_params['shop'])
58
- end
59
-
60
- def shopify_auth_params
61
- strategy.session['shopify.omniauth_params']&.with_indifferent_access
62
- end
63
- end
64
- end