model_driven_api 3.13.3 → 3.14.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: 5052641c8f3fa980a3c9915cf68a648a01ac0ad4ef1408f9443a75548fdd97ea
|
|
4
|
+
data.tar.gz: 055bcd8c2c8a12f4d759872e7f773d696376de7b3807f78e2f7dd460566b2f77
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 63ec03f80e8edf607afd307872d6f341aff0e0fa0ed20e73d96bb7f60bcde09a7c00a8f8cae8c8eb9a50a71a9fbda6d249481414d73c0acdf25e181fbc003b9c
|
|
7
|
+
data.tar.gz: d254e5ea911993a3e677ce0ea8de5bb1621d0c890949fae6cb3a38cc76315addbd03580790ff8043e72e07cfb0a367078a973e02c4c3f78e3eaa34ada817cf4c
|
data/README.md
CHANGED
|
@@ -82,6 +82,8 @@ Every subsequent authenticated request returns a fresh `Token` header (sliding e
|
|
|
82
82
|
|
|
83
83
|
Token expiry is controlled by the `SESSION_TIMEOUT_IN_MINUTES` env var (default: 31 minutes).
|
|
84
84
|
|
|
85
|
+
A locked user (`users.locked`) gets the same answer as a wrong password, and a token issued before the lock answers `401` and is not renewed.
|
|
86
|
+
|
|
85
87
|
When `ALLOW_MULTISESSIONS=false`, each login invalidates all previous tokens for the user (stored in the `used_tokens` table).
|
|
86
88
|
|
|
87
89
|
### Bearer token usage (v2 and v3)
|
|
@@ -40,7 +40,9 @@ class AuthenticateUser
|
|
|
40
40
|
#Try to authenticate the user against LDAP if user is not present at this point
|
|
41
41
|
user = Ldap::Authenticator.new(email: email, password: password).authenticate if user.blank?
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
# A locked user is refused like a wrong password, whichever way they authenticated
|
|
44
|
+
# (User#active_for_authentication?, thecore_auth_commons; Odoo #6051).
|
|
45
|
+
raise AccessDenied unless user.present? && user.active_for_authentication?
|
|
44
46
|
|
|
45
47
|
return user
|
|
46
48
|
end
|
|
@@ -16,7 +16,8 @@ class AuthorizeApiRequest
|
|
|
16
16
|
def api_user
|
|
17
17
|
Rails.logger.debug "AuthorizeApiRequest: api_user -> #{decoded_auth_token}"
|
|
18
18
|
@api_user ||= (decoded_auth_token.blank? ? nil : User.find(decoded_auth_token[:user_id]))
|
|
19
|
-
|
|
19
|
+
# A JWT still valid from before a lock gets no answer and no renewed token (Odoo #6051).
|
|
20
|
+
if @api_user.present? && @api_user.active_for_authentication?
|
|
20
21
|
return @api_user
|
|
21
22
|
else
|
|
22
23
|
errors.add(:token, "Invalid or Expired token")
|
|
@@ -11,7 +11,8 @@ module Api::V2::Auth
|
|
|
11
11
|
info.last_name,
|
|
12
12
|
auth.provider)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
# A locked user gets the same answer as an unknown one (Odoo #6051).
|
|
15
|
+
unless user&.active_for_authentication?
|
|
15
16
|
render json: { error: "User not registered" }, status: :unauthorized
|
|
16
17
|
return
|
|
17
18
|
end
|
|
@@ -61,7 +62,7 @@ module Api::V2::Auth
|
|
|
61
62
|
email = user_info["mail"] || user_info["email"] || user_info["userPrincipalName"]
|
|
62
63
|
user = User.find_by(email: email)
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
unless user&.active_for_authentication?
|
|
65
66
|
return render json: { error: "User not registered" }, status: :unauthorized
|
|
66
67
|
end
|
|
67
68
|
|
data/lib/model_driven_api.rb
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
require 'endpoint_validation_error'
|
|
2
2
|
require 'non_crud_endpoints'
|
|
3
|
+
# Its own runtime dependency (User#active_for_authentication?, check_user, Ldap::Authenticator):
|
|
4
|
+
# required here rather than trusted to come through thecore_backend_commons.
|
|
5
|
+
require 'thecore_auth_commons'
|
|
3
6
|
require 'thecore_backend_commons'
|
|
4
7
|
require 'rack/cors'
|
|
5
8
|
require 'ransack'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: model_driven_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.14.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_backend_commons
|
|
@@ -24,6 +24,26 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '3.8'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: thecore_auth_commons
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 3.7.0
|
|
34
|
+
- - "<"
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '4'
|
|
37
|
+
type: :runtime
|
|
38
|
+
prerelease: false
|
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: 3.7.0
|
|
44
|
+
- - "<"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '4'
|
|
27
47
|
- !ruby/object:Gem::Dependency
|
|
28
48
|
name: jwt
|
|
29
49
|
requirement: !ruby/object:Gem::Requirement
|