katalyst-koi 5.13.2 → 5.13.3
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/lib/koi/middleware/admin_authentication.rb +11 -2
- 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: f7398eed1765ce0345e3df97c21066386ebfbb50549e677d67911059d87e1b5d
|
|
4
|
+
data.tar.gz: 33d95ed951170087c08848cc7fd7f27b84c3f14d6c16c0691b21e34e4ba173a5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ebcbc3880b4711894a225d4187f8895416020b93697b47216acfdefd7582ca9c70dae6af15505f661f6ef6a9e9c696809161ba36409a27fa82fcfda386a6c80
|
|
7
|
+
data.tar.gz: 763c4c3a5e0fcad8142c8c950a85a111d65466022c6e35155cc7078547df1487ab501d52f894751f5c9327a56d6e3f47ae3c433eada70de3fcf770ef5877d975
|
|
@@ -8,7 +8,7 @@ module Koi
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def call(env)
|
|
11
|
-
if env["PATH_INFO"]
|
|
11
|
+
if admin_path?(env["PATH_INFO"])
|
|
12
12
|
admin_call(env)
|
|
13
13
|
else
|
|
14
14
|
@app.call(env)
|
|
@@ -43,8 +43,17 @@ module Koi
|
|
|
43
43
|
|
|
44
44
|
private
|
|
45
45
|
|
|
46
|
+
# Compare paths the way the router will see them, e.g. "//admin" routes to "/admin"
|
|
47
|
+
def normalize_path(path)
|
|
48
|
+
ActionDispatch::Journey::Router::Utils.normalize_path(path)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def admin_path?(path)
|
|
52
|
+
normalize_path(path).starts_with?("/admin")
|
|
53
|
+
end
|
|
54
|
+
|
|
46
55
|
def requires_authentication?(request)
|
|
47
|
-
!request.path.starts_with?("/admin/session") && !device_flow_request?(request:)
|
|
56
|
+
!normalize_path(request.path).starts_with?("/admin/session") && !device_flow_request?(request:)
|
|
48
57
|
end
|
|
49
58
|
|
|
50
59
|
def authenticated?
|