sidekiq_web_google_auth 0.3.0 → 0.3.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/sidekiq_web_google_auth/builder.rb +15 -1
- data/sidekiq_web_google_auth.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 338e2a345aedf3023bde02fa3169743497147bb30e93292823377cbcff949a06
|
|
4
|
+
data.tar.gz: ff7a6d37c164a171a81a8cde9a128b28d226058d6ed9fab7e6b897b7d76cb7e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 794d9d848099386a38363779efce2eed73a14e7c24017b3eed2c7b125cf7f5983e50563f423a739a303ade118754f87eee7f2a67d356c65225281d5bbb446828
|
|
7
|
+
data.tar.gz: 98105507c2e1c02e347ef17f64d782514338197b6d9b461593a17fd445df52e435aae35ebfc8711fa6467492183666658b33f4351ef5cff108e209566a866c2c
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -35,7 +35,7 @@ SidekiqWebGoogleAuth.setup!(
|
|
|
35
35
|
)
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Unauthenticated visitors go directly to Google. By default, Google shows the account picker (`prompt: "select_account"`). If the selected account is denied, the access-denied page links back to Google so visitors can choose another account. Logging out lands on a signed-out page instead of redirecting straight back to Google. The links on the access-denied and signed-out pages always show the account picker, even with `prompt: nil`.
|
|
38
|
+
Unauthenticated visitors go directly to Google. Only page loads are sent to Google; background requests from a signed-out tab, such as the dashboard's polling, get a `401` instead. By default, Google shows the account picker (`prompt: "select_account"`). If the selected account is denied, the access-denied page links back to Google so visitors can choose another account. Logging out lands on a signed-out page instead of redirecting straight back to Google. The links on the access-denied and signed-out pages always show the account picker, even with `prompt: nil`.
|
|
39
39
|
|
|
40
40
|
Pass additional `omniauth-google-oauth2` options as keywords to `setup!`. For example, add `hd: "example.com", prompt: "consent select_account"` to hint at a hosted domain and request both consent and account selection. Pass `prompt: nil` to omit the configured prompt and let Google use its default sign-in behavior. The provider name is always `oauth`, even if you pass `name:`.
|
|
41
41
|
|
|
@@ -25,7 +25,21 @@ module SidekiqWebGoogleAuth
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def deny(env)
|
|
28
|
-
|
|
28
|
+
if navigation?(env)
|
|
29
|
+
[302, { "location" => "#{env["SCRIPT_NAME"]}/auth/oauth" }, ["Found"]]
|
|
30
|
+
else
|
|
31
|
+
[401, { "content-type" => "text/plain" }, ["Unauthorized"]]
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Background requests (e.g. dashboard polling) must not start a sign-in: it overwrites the
|
|
36
|
+
# OmniAuth state of a sign-in in progress.
|
|
37
|
+
def navigation?(env)
|
|
38
|
+
case env["HTTP_SEC_FETCH_MODE"]
|
|
39
|
+
when "navigate" then env.fetch("HTTP_SEC_FETCH_DEST", "document") == "document"
|
|
40
|
+
when nil then env["HTTP_ACCEPT"].to_s.include?("text/html")
|
|
41
|
+
else false
|
|
42
|
+
end
|
|
29
43
|
end
|
|
30
44
|
|
|
31
45
|
def session(env)
|