shopify_app 14.4.2 → 14.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/controllers/shopify_app/callback_controller.rb +48 -21
- data/lib/shopify_app/version.rb +1 -1
- data/package.json +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4943d62d694b896b3459f7c120ad33e05a71826af48c30c8449e0b213f8792c3
|
4
|
+
data.tar.gz: c12f15a9ca8e94f03e6c00dbac9d1e1d6651571cd96991318ec533db069d6fe6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fb092bd7b4085ea4f9fafe196c4f56f09a709120e2ae206fb174f8858bb39324335cbfb0b066ad24d131f37d31ec872887899a074436fa6f2290e72dc4f1f43
|
7
|
+
data.tar.gz: 1f77669706cd7ad0065bc6b5bc30744a2b9e4da61190266cfb7efc9f2127f1b0c0cd030d968dca1c80ce6bde4c842ed16b9d38bff899e50f63b11e74159572a6
|
data/CHANGELOG.md
CHANGED
@@ -6,50 +6,77 @@ module ShopifyApp
|
|
6
6
|
include ShopifyApp::LoginProtection
|
7
7
|
|
8
8
|
def callback
|
9
|
-
|
10
|
-
return respond_with_error
|
11
|
-
end
|
9
|
+
return respond_with_error if invalid_request?
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
store_access_token_and_build_session
|
12
|
+
|
13
|
+
if start_user_token_flow?
|
14
|
+
return respond_with_user_token_flow
|
16
15
|
end
|
17
16
|
|
17
|
+
perform_post_authenticate_jobs
|
18
|
+
|
19
|
+
respond_successfully
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def respond_successfully
|
18
25
|
if jwt_request?
|
19
|
-
Rails.logger.debug("[ShopifyApp::CallbackController] JWT request detected. Setting shopify session...")
|
20
|
-
set_shopify_session
|
21
26
|
head(:ok)
|
22
27
|
else
|
28
|
+
redirect_to(return_address)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def respond_with_user_token_flow
|
33
|
+
Rails.logger.debug("[ShopifyApp::CallbackController] Redirecting for user token...")
|
34
|
+
redirect_to(login_url_with_optional_shop)
|
35
|
+
end
|
36
|
+
|
37
|
+
def store_access_token_and_build_session
|
38
|
+
if native_browser_request?
|
23
39
|
Rails.logger.debug("[ShopifyApp::CallbackController] Not a JWT request. Resetting session options...")
|
24
40
|
reset_session_options
|
25
|
-
|
41
|
+
else
|
42
|
+
Rails.logger.debug("[ShopifyApp::CallbackController] JWT request detected. Setting shopify session...")
|
43
|
+
end
|
44
|
+
set_shopify_session
|
45
|
+
end
|
26
46
|
|
27
|
-
|
28
|
-
|
29
|
-
return redirect_to(login_url_with_optional_shop)
|
30
|
-
end
|
47
|
+
def invalid_request?
|
48
|
+
return true unless auth_hash
|
31
49
|
|
32
|
-
|
33
|
-
|
34
|
-
perform_after_authenticate_job
|
50
|
+
jwt_request? && !valid_jwt_auth?
|
51
|
+
end
|
35
52
|
|
36
|
-
|
37
|
-
|
53
|
+
def native_browser_request?
|
54
|
+
!jwt_request?
|
38
55
|
end
|
39
56
|
|
40
|
-
|
57
|
+
def perform_post_authenticate_jobs
|
58
|
+
install_webhooks
|
59
|
+
install_scripttags
|
60
|
+
perform_after_authenticate_job
|
61
|
+
end
|
41
62
|
|
42
63
|
def respond_with_error
|
43
64
|
if jwt_request?
|
65
|
+
Rails.logger.debug("[ShopifyApp::CallbackController] Invalid JWT auth detected.")
|
44
66
|
head(:unauthorized)
|
45
67
|
else
|
68
|
+
Rails.logger.debug("[ShopifyApp::CallbackController] Invalid non JWT auth detected.")
|
46
69
|
flash[:error] = I18n.t('could_not_log_in')
|
47
70
|
redirect_to(login_url_with_optional_shop)
|
48
71
|
end
|
49
72
|
end
|
50
73
|
|
51
|
-
def
|
52
|
-
|
74
|
+
def start_user_token_flow?
|
75
|
+
if jwt_request?
|
76
|
+
false
|
77
|
+
else
|
78
|
+
ShopifyApp::SessionRepository.user_storage.present? && user_session.blank?
|
79
|
+
end
|
53
80
|
end
|
54
81
|
|
55
82
|
def jwt_request?
|
data/lib/shopify_app/version.rb
CHANGED
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.4.
|
4
|
+
version: 14.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: browser_sniffer
|