thecore_backend_commons 3.11.0 → 3.12.0
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ddc427f91f30a41460afead62731a1d602b6917aca2a97fedce0b50917d5f328
|
|
4
|
+
data.tar.gz: ece1a417d1c4ba18fa5a48f3446cddd9b6d90828caeb528b0b6352f538240518
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e97593b400468ab3515ac237f50027ee8247bbad7c463b4f0fa115c5d5dd6a157a539dfea6bba0951b8d94dcb723f750d2ee06a92fef4c2eba99403d94ed719e
|
|
7
|
+
data.tar.gz: 37d2840f2c66e15b3f2dc646c3d8eedb7109276a44c7cf2666129abb4372c16a30efcaef46c0666dad80665c86a08ec434e178d8969df55741b32a64b06fbde0
|
|
@@ -13,9 +13,10 @@ module CableConnectionConcern
|
|
|
13
13
|
|
|
14
14
|
def find_verified_user
|
|
15
15
|
# An already-authenticated Devise/Warden session (e.g. RailsAdmin in the browser) is
|
|
16
|
-
# trusted
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
# trusted, before looking at any token. Devise throws :warden when it refuses the session's
|
|
17
|
+
# user (a locked one): outside the Warden middleware nobody catches it, so catch it here.
|
|
18
|
+
warden_user = catch(:warden) { env["warden"]&.user }
|
|
19
|
+
return active_or_reject(warden_user) if warden_user.is_a?(User)
|
|
19
20
|
|
|
20
21
|
# Looks for a token in the query parameters, or in the "Authorization" header.
|
|
21
22
|
m = request.query_parameters["token"].presence ||
|
|
@@ -28,7 +29,7 @@ module CableConnectionConcern
|
|
|
28
29
|
if User.column_names.include?("encrypted_access_token")
|
|
29
30
|
m2m_user = User.where.not(encrypted_access_token: nil)
|
|
30
31
|
.find { |u| BCrypt::Password.new(u.encrypted_access_token) == m } rescue nil
|
|
31
|
-
return m2m_user if m2m_user
|
|
32
|
+
return active_or_reject(m2m_user) if m2m_user
|
|
32
33
|
end
|
|
33
34
|
|
|
34
35
|
# JWT: the signature MUST be verified, exactly like every REST request. Decoding with the
|
|
@@ -37,12 +38,19 @@ module CableConnectionConcern
|
|
|
37
38
|
# record change, so that was a full read bypass. See docs/adr and the issue tracker.
|
|
38
39
|
body = decode_verified_jwt(m)
|
|
39
40
|
jwt_user = User.find_by(id: body[:user_id]) if body && body[:user_id]
|
|
40
|
-
return jwt_user if jwt_user
|
|
41
|
+
return active_or_reject(jwt_user) if jwt_user
|
|
41
42
|
|
|
42
43
|
# Neither a valid m2m nor a valid JWT token: refuse the connection.
|
|
43
44
|
reject_unauthorized_connection
|
|
44
45
|
end
|
|
45
46
|
|
|
47
|
+
# A locked user is refused whatever credential they still hold (session, m2m token, JWT):
|
|
48
|
+
# User#active_for_authentication? is the check every login channel uses (thecore_auth_commons
|
|
49
|
+
# >= 3.7.0; Odoo #6051).
|
|
50
|
+
def active_or_reject(user)
|
|
51
|
+
user.active_for_authentication? ? user : reject_unauthorized_connection
|
|
52
|
+
end
|
|
53
|
+
|
|
46
54
|
# Decodes and VERIFIES a JWT. Reuses model_driven_api's JsonWebToken when present, so the
|
|
47
55
|
# WebSocket shares the REST API's signing key, key-rotation and single-session handling;
|
|
48
56
|
# falls back to a signature-verifying decode so this gem still works on its own. Returns nil
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: thecore_backend_commons
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.12.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gabriele Tassoni
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thecore_auth_commons
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '3.
|
|
19
|
+
version: '3.7'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '3.
|
|
26
|
+
version: '3.7'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: thecore_background_jobs
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|