decidim-trusted_ids 0.12.0 → 0.13.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 +4 -4
- data/README.md +18 -14
- data/app/commands/concerns/decidim/trusted_ids/system/needs_census_config.rb +1 -1
- data/app/controllers/concerns/decidim/trusted_ids/admin/impersonations_controller_override.rb +2 -2
- data/app/controllers/concerns/decidim/trusted_ids/check_omniauth_email_on_login.rb +1 -1
- data/app/forms/decidim/trusted_ids/verifications/trusted_ids_handler.rb +2 -2
- data/app/forms/decidim/via_oberta/verifications/via_oberta_handler.rb +2 -2
- data/app/jobs/decidim/trusted_ids/omniauth_verification_job.rb +1 -1
- data/app/models/decidim/trusted_ids/organization_config.rb +1 -0
- data/config/locales/de.yml +4 -4
- data/config/locales/en.yml +4 -4
- data/config/locales/fr.yml +4 -4
- data/config/locales/it.yml +4 -4
- data/lib/decidim/trusted_ids/version.rb +3 -3
- data/lib/decidim/trusted_ids.rb +10 -10
- data/package-lock.json +9689 -2562
- data/package.json +6 -6
- metadata +20 -23
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b7f4bc28edbb47bd7dc527d03d4d7e1f24dc93dc499c5c3b182193f5d9cfc4c
|
|
4
|
+
data.tar.gz: 95cd5a3983405d107072f2c1a847899ce69a1a0b6b59d8ab6a94b5a3627900ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 71c723aa05ab5f68ede805083abf98c138805f83241b440236088206c4a0f0b4fa9235ff3b4d39007c38a9a8ca7a2922b56321d3d30820886380177a0c11ffd4
|
|
7
|
+
data.tar.gz: 8d92bd7edc4eba33035e2109e94f6f47c3756c3a43e6d68eb5351126ee6db79fadd6135823029c968022ec1d0706496cf50211efcd0b1eb010fb6b5e8c2e135d
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Decidim ::
|
|
1
|
+
# Decidim :: Authenticated identities for the public sector
|
|
2
2
|
|
|
3
3
|
[![[CI] Lint](https://github.com/ConsorciAOC-PRJ/decidim-module-trusted-ids/actions/workflows/lint.yml/badge.svg)](https://github.com/ConsorciAOC-PRJ/decidim-module-trusted-ids/actions/workflows/lint.yml)
|
|
4
4
|
[![[CI] Test](https://github.com/ConsorciAOC-PRJ/decidim-module-trusted-ids/actions/workflows/test.yml/badge.svg)](https://github.com/ConsorciAOC-PRJ/decidim-module-trusted-ids/actions/workflows/test.yml)
|
|
@@ -170,21 +170,25 @@ If you are using a different source for your settings, you can also configure th
|
|
|
170
170
|
For instance, create a file `config/initializers/decidim_trusted_ids.rb` with the following content:
|
|
171
171
|
|
|
172
172
|
```ruby
|
|
173
|
-
Decidim::TrustedIds.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
173
|
+
Decidim::TrustedIds.omniauth_provider = "valid"
|
|
174
|
+
Decidim::TrustedIds.omniauth = {
|
|
175
|
+
enabled: true,
|
|
176
|
+
client_id: "my-client-id",
|
|
177
|
+
client_secret: "my-client-secret",
|
|
178
|
+
site: "https://valid.aoc.cat",
|
|
179
|
+
scope: "autenticacio_usuari",
|
|
180
|
+
icon_path: "media/images/valid-icon.png"
|
|
181
|
+
}
|
|
182
|
+
Decidim::TrustedIds.census_authorization = {
|
|
183
|
+
handler: :via_oberta_handler,
|
|
184
|
+
form: "Decidim::ViaOberta::Verifications::ViaObertaHandler",
|
|
185
|
+
env: "production",
|
|
186
|
+
system_attributes: %w(nif ine municipal_code province_code organization_name)
|
|
187
|
+
}
|
|
186
188
|
```
|
|
187
189
|
|
|
190
|
+
Set only the values you need to override. The available settings are the accessors defined in [`lib/decidim/trusted_ids.rb`](lib/decidim/trusted_ids.rb); assign them directly on `Decidim::TrustedIds` as shown above.
|
|
191
|
+
|
|
188
192
|
For the complete list of available options, see the [trusted_ids](lib/decidim/trusted_ids.rb) file.
|
|
189
193
|
|
|
190
194
|
### Screenshots
|
|
@@ -8,7 +8,7 @@ module Decidim
|
|
|
8
8
|
|
|
9
9
|
included do
|
|
10
10
|
def save_census_config!(organization)
|
|
11
|
-
conf = Decidim::TrustedIds::OrganizationConfig.find_or_initialize_by(organization:
|
|
11
|
+
conf = Decidim::TrustedIds::OrganizationConfig.find_or_initialize_by(organization:)
|
|
12
12
|
conf.handler = TrustedIds.census_authorization[:handler]
|
|
13
13
|
return if conf.handler.blank?
|
|
14
14
|
|
data/app/controllers/concerns/decidim/trusted_ids/admin/impersonations_controller_override.rb
CHANGED
|
@@ -13,13 +13,13 @@ module Decidim
|
|
|
13
13
|
helper Decidim::OmniauthHelper
|
|
14
14
|
|
|
15
15
|
# the internal 1st step verification shouldn't be used for impersonations as it is linked with an OAuth login
|
|
16
|
-
def other_available_authorization_handlers
|
|
16
|
+
def other_available_authorization_handlers # rubocop:disable Decidim/EnforcePermissionTo
|
|
17
17
|
Decidim::Verifications::Adapter.from_collection(
|
|
18
18
|
current_organization.available_authorization_handlers - [handler_name, "trusted_ids_handler"]
|
|
19
19
|
)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def available_authorization_handlers
|
|
22
|
+
def available_authorization_handlers # rubocop:disable Decidim/EnforcePermissionTo
|
|
23
23
|
Decidim::Verifications::Adapter.from_collection(
|
|
24
24
|
current_organization.available_authorization_handlers - ["trusted_ids_handler"]
|
|
25
25
|
)
|
|
@@ -59,7 +59,7 @@ module Decidim
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def census_response
|
|
62
|
-
@census_response ||= ViaOberta::Api::Request.new(document_id
|
|
62
|
+
@census_response ||= ViaOberta::Api::Request.new(document_id:, document_type:, organization:).response
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def existing_via_oberta_identity
|
|
@@ -91,7 +91,7 @@ module Decidim
|
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def trusted_authorization
|
|
94
|
-
@trusted_authorization ||= Decidim::Authorization.find_by(name: "trusted_ids_handler", user:
|
|
94
|
+
@trusted_authorization ||= Decidim::Authorization.find_by(name: "trusted_ids_handler", user:)
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
def organization
|
|
@@ -34,7 +34,7 @@ module Decidim
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def handler
|
|
37
|
-
@handler ||= Decidim::AuthorizationHandler.handler_for("trusted_ids_handler", user
|
|
37
|
+
@handler ||= Decidim::AuthorizationHandler.handler_for("trusted_ids_handler", user:, uid: data[:uid], provider: data[:provider], raw_data: data[:raw_data])
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def authorization
|
data/config/locales/de.yml
CHANGED
|
@@ -31,12 +31,12 @@ de:
|
|
|
31
31
|
authorization_handlers:
|
|
32
32
|
trusted_ids_handler:
|
|
33
33
|
explanation: This authorization is granted to all users who use a login method
|
|
34
|
-
with
|
|
34
|
+
with an authenticated identity.
|
|
35
35
|
fields:
|
|
36
36
|
extra: Additional information
|
|
37
37
|
provider: Provider
|
|
38
38
|
uid: ID
|
|
39
|
-
name:
|
|
39
|
+
name: Authenticated identities
|
|
40
40
|
via_oberta_handler:
|
|
41
41
|
explanation: This authorization is granted to all users who are in the Via
|
|
42
42
|
Oberta census database.
|
|
@@ -89,8 +89,8 @@ de:
|
|
|
89
89
|
providers:
|
|
90
90
|
default:
|
|
91
91
|
description: This authorization is granted to all users who use a login
|
|
92
|
-
method with
|
|
93
|
-
name:
|
|
92
|
+
method with an authenticated identity.
|
|
93
|
+
name: Authenticated identities
|
|
94
94
|
valid:
|
|
95
95
|
description: VÀLid is a service that AOC provides to Catalan public administrations
|
|
96
96
|
to integrate the different available digital identification mechanisms (idCAT
|
data/config/locales/en.yml
CHANGED
|
@@ -32,12 +32,12 @@ en:
|
|
|
32
32
|
authorization_handlers:
|
|
33
33
|
trusted_ids_handler:
|
|
34
34
|
explanation: This authorization is granted to all users who use a login method
|
|
35
|
-
with
|
|
35
|
+
with an authenticated identity.
|
|
36
36
|
fields:
|
|
37
37
|
extra: Additional information
|
|
38
38
|
provider: Provider
|
|
39
39
|
uid: ID
|
|
40
|
-
name:
|
|
40
|
+
name: Authenticated identities
|
|
41
41
|
via_oberta_handler:
|
|
42
42
|
explanation: This authorization is granted to all users who are in the Via
|
|
43
43
|
Oberta census database.
|
|
@@ -90,8 +90,8 @@ en:
|
|
|
90
90
|
providers:
|
|
91
91
|
default:
|
|
92
92
|
description: This authorization is granted to all users who use a login
|
|
93
|
-
method with
|
|
94
|
-
name:
|
|
93
|
+
method with an authenticated identity.
|
|
94
|
+
name: Authenticated identities
|
|
95
95
|
valid:
|
|
96
96
|
description: VÀLid is a service that AOC provides to Catalan public administrations
|
|
97
97
|
to integrate the different available digital identification mechanisms
|
data/config/locales/fr.yml
CHANGED
|
@@ -31,12 +31,12 @@ fr:
|
|
|
31
31
|
authorization_handlers:
|
|
32
32
|
trusted_ids_handler:
|
|
33
33
|
explanation: This authorization is granted to all users who use a login method
|
|
34
|
-
with
|
|
34
|
+
with an authenticated identity.
|
|
35
35
|
fields:
|
|
36
36
|
extra: Additional information
|
|
37
37
|
provider: Provider
|
|
38
38
|
uid: ID
|
|
39
|
-
name:
|
|
39
|
+
name: Authenticated identities
|
|
40
40
|
via_oberta_handler:
|
|
41
41
|
explanation: This authorization is granted to all users who are in the Via
|
|
42
42
|
Oberta census database.
|
|
@@ -89,8 +89,8 @@ fr:
|
|
|
89
89
|
providers:
|
|
90
90
|
default:
|
|
91
91
|
description: This authorization is granted to all users who use a login
|
|
92
|
-
method with
|
|
93
|
-
name:
|
|
92
|
+
method with an authenticated identity.
|
|
93
|
+
name: Authenticated identities
|
|
94
94
|
valid:
|
|
95
95
|
description: VÀLid is a service that AOC provides to Catalan public administrations
|
|
96
96
|
to integrate the different available digital identification systems (idCAT
|
data/config/locales/it.yml
CHANGED
|
@@ -31,12 +31,12 @@ it:
|
|
|
31
31
|
authorization_handlers:
|
|
32
32
|
trusted_ids_handler:
|
|
33
33
|
explanation: This authorization is granted to all users who use a login method
|
|
34
|
-
with
|
|
34
|
+
with an authenticated identity.
|
|
35
35
|
fields:
|
|
36
36
|
extra: Additional information
|
|
37
37
|
provider: Provider
|
|
38
38
|
uid: ID
|
|
39
|
-
name:
|
|
39
|
+
name: Authenticated identities
|
|
40
40
|
via_oberta_handler:
|
|
41
41
|
explanation: This authorization is granted to all users who are in the Via
|
|
42
42
|
Oberta census database.
|
|
@@ -89,8 +89,8 @@ it:
|
|
|
89
89
|
providers:
|
|
90
90
|
default:
|
|
91
91
|
description: This authorization is granted to all users who use a login
|
|
92
|
-
method with
|
|
93
|
-
name:
|
|
92
|
+
method with an authenticated identity.
|
|
93
|
+
name: Authenticated identities
|
|
94
94
|
valid:
|
|
95
95
|
description: VÀLid is a service that AOC provides to Catalan public administrations
|
|
96
96
|
to integrate the different available digital identification mechanisms (idCAT
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
module Decidim
|
|
4
4
|
# This holds the decidim-trusted_ids version.
|
|
5
5
|
module TrustedIds
|
|
6
|
-
VERSION = "0.
|
|
7
|
-
DECIDIM_VERSION = "0.
|
|
8
|
-
COMPAT_DECIDIM_VERSION = [">= 0.
|
|
6
|
+
VERSION = "0.13.0"
|
|
7
|
+
DECIDIM_VERSION = "0.32.2"
|
|
8
|
+
COMPAT_DECIDIM_VERSION = [">= 0.32", "< 0.33"].freeze
|
|
9
9
|
end
|
|
10
10
|
end
|
data/lib/decidim/trusted_ids.rb
CHANGED
|
@@ -5,8 +5,6 @@ require "decidim/trusted_ids/engine"
|
|
|
5
5
|
|
|
6
6
|
module Decidim
|
|
7
7
|
module TrustedIds
|
|
8
|
-
include ActiveSupport::Configurable
|
|
9
|
-
|
|
10
8
|
def self.omniauth_env(key, default = nil)
|
|
11
9
|
ENV.fetch("#{TrustedIds.omniauth_provider.upcase}_#{key}", default)
|
|
12
10
|
end
|
|
@@ -24,33 +22,35 @@ module Decidim
|
|
|
24
22
|
end
|
|
25
23
|
end
|
|
26
24
|
|
|
25
|
+
# Note that initialization on this module is done in the engine.rb file, as it needs to be done using dynamic values from the environment.
|
|
26
|
+
|
|
27
27
|
# The name of the omniauth provider, must be registered in Decidim.
|
|
28
28
|
# Leave it empty to disable omniauth authentication.
|
|
29
|
-
|
|
29
|
+
mattr_accessor :omniauth_provider
|
|
30
30
|
|
|
31
31
|
# From the data obtained we extract metadata to be saved as part of the authorization
|
|
32
32
|
# This data can later be used by the census_authorization handler as to call the webservice
|
|
33
33
|
# A hash with keys and how to find it inside hash comming from the OAuth
|
|
34
|
-
|
|
34
|
+
mattr_accessor :authorization_metadata
|
|
35
35
|
|
|
36
36
|
# setup a hash with :client_id, :client_secret and :site to enable omniauth authentication
|
|
37
|
-
|
|
37
|
+
mattr_accessor :omniauth
|
|
38
38
|
|
|
39
39
|
# which of the former attributes can not set a the /system configuration, there are all the same for all tenants
|
|
40
|
-
|
|
40
|
+
mattr_accessor :omniauth_global_attributes
|
|
41
41
|
|
|
42
42
|
# wheter to use a custom login screen or the default one
|
|
43
|
-
|
|
43
|
+
mattr_accessor :custom_login_screen
|
|
44
44
|
|
|
45
45
|
# how long the verification will be valid, defaults to 90 days
|
|
46
46
|
# if empty or nil, the verification will never expire
|
|
47
|
-
|
|
47
|
+
mattr_accessor :verification_expiration_time
|
|
48
48
|
|
|
49
49
|
# if false, no notifications will be send to users when automatic verifications are performed
|
|
50
|
-
|
|
50
|
+
mattr_accessor :send_verification_notifications
|
|
51
51
|
|
|
52
52
|
# Linked authorization method that will automatically verify users after getting a valid TrustedIds verification
|
|
53
|
-
|
|
53
|
+
mattr_accessor :census_authorization
|
|
54
54
|
|
|
55
55
|
def self.census_config_attributes
|
|
56
56
|
return [] if TrustedIds.census_authorization[:handler].blank?
|