decidim-trusted_ids 0.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 +7 -0
- data/LICENSE-AGPLv3.txt +661 -0
- data/README.md +344 -0
- data/Rakefile +40 -0
- data/app/commands/concerns/decidim/trusted_ids/system/create_organization_override.rb +22 -0
- data/app/commands/concerns/decidim/trusted_ids/system/needs_census_config.rb +29 -0
- data/app/commands/concerns/decidim/trusted_ids/system/update_organization_override.rb +21 -0
- data/app/controllers/concerns/decidim/trusted_ids/admin/impersonations_controller_override.rb +31 -0
- data/app/controllers/concerns/decidim/trusted_ids/check_existing_authorizations.rb +40 -0
- data/app/controllers/concerns/decidim/trusted_ids/check_omniauth_email_on_login.rb +25 -0
- data/app/controllers/concerns/decidim/trusted_ids/needs_trusted_ids_snippets.rb +26 -0
- data/app/events/decidim/trusted_ids/verifications/invalid_notification.rb +10 -0
- data/app/events/decidim/trusted_ids/verifications/success_notification.rb +33 -0
- data/app/forms/concerns/decidim/trusted_ids/system/organization_form_override.rb +93 -0
- data/app/forms/decidim/trusted_ids/verifications/trusted_ids_handler.rb +65 -0
- data/app/forms/decidim/via_oberta/verifications/via_oberta_handler.rb +103 -0
- data/app/jobs/decidim/trusted_ids/application_job.rb +8 -0
- data/app/jobs/decidim/trusted_ids/omniauth_verification_job.rb +76 -0
- data/app/jobs/decidim/trusted_ids/system/propagate_census_config_job.rb +29 -0
- data/app/jobs/decidim/trusted_ids/system/propagate_census_settings_job.rb +29 -0
- data/app/models/concerns/decidim/trusted_ids/authorization_override.rb +21 -0
- data/app/models/concerns/decidim/trusted_ids/organization_override.rb +17 -0
- data/app/models/decidim/trusted_ids/organization_config.rb +20 -0
- data/app/overrides/decidim/devise/sessions/new/add_trusted_id_buttons.html.erb.deface +3 -0
- data/app/overrides/decidim/devise/sessions/new/wrap_default_login_form.html.erb.deface +4 -0
- data/app/overrides/decidim/devise/shared/_omniauth_buttons/replace_button_content.html.erb.deface +17 -0
- data/app/overrides/decidim/devise/shared/_omniauth_buttons/skip_trusted_ids_provider.html.erb.deface +3 -0
- data/app/overrides/decidim/system/organizations/_advanced_settings/settings_form.html.erb.deface +3 -0
- data/app/overrides/decidim/system/organizations/_omniauth_provider/add_icon_placeholder.html.erb.deface +3 -0
- data/app/overrides/layouts/decidim/_head/add_trusted_ids_tags.html.erb.deface +11 -0
- data/app/packs/entrypoints/decidim_trusted_ids.js +3 -0
- data/app/packs/images/idcat_mobil-icon.svg +8 -0
- data/app/packs/images/valid-icon.png +0 -0
- data/app/packs/stylesheets/decidim/trusted_ids/oauth_icons.scss +75 -0
- data/app/services/decidim/via_oberta/api/request.rb +156 -0
- data/app/services/decidim/via_oberta/api/response.rb +67 -0
- data/app/views/decidim/trusted_ids/devise/sessions/_login_box.html.erb +30 -0
- data/app/views/decidim/trusted_ids/system/organizations/_icon_path_placeholder.html.erb +10 -0
- data/app/views/decidim/trusted_ids/system/organizations/_settings_form.html.erb +25 -0
- data/app/views/decidim/trusted_ids/verifications/_form.html.erb +39 -0
- data/app/views/decidim/via_oberta/verifications/_form.html.erb +56 -0
- data/config/assets.rb +16 -0
- data/config/i18n-tasks.yml +12 -0
- data/config/locales/ca.yml +132 -0
- data/config/locales/de.yml +168 -0
- data/config/locales/en.yml +169 -0
- data/config/locales/es.yml +132 -0
- data/config/locales/fr.yml +168 -0
- data/config/locales/it.yml +168 -0
- data/config/locales/oc.yml +132 -0
- data/config/locales/zz_fallbacks.rb +45 -0
- data/db/migrate/20230718082548_create_organization_trusted_ids_config.rb +14 -0
- data/lib/decidim/trusted_ids/engine.rb +181 -0
- data/lib/decidim/trusted_ids/test/factories.rb +21 -0
- data/lib/decidim/trusted_ids/verifications.rb +10 -0
- data/lib/decidim/trusted_ids/version.rb +10 -0
- data/lib/decidim/trusted_ids.rb +69 -0
- data/lib/omniauth/strategies/valid.rb +134 -0
- data/lib/omniauth/strategies.rb +7 -0
- data/lib/tasks/decidim_trusted_ids_upgrade_tasks.rake +5 -0
- data/package-lock.json +29154 -0
- data/package.json +43 -0
- metadata +200 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
it:
|
|
3
|
+
activemodel:
|
|
4
|
+
errors:
|
|
5
|
+
messages:
|
|
6
|
+
invalid_icon_path_format: must be in the format media/images/filename
|
|
7
|
+
icon_path_not_found: the icon file does not exist in the registered asset paths
|
|
8
|
+
attributes:
|
|
9
|
+
trusted_ids_census_config:
|
|
10
|
+
census_expiration_apply_all_tenants: 'Apply to all tenants (this will set
|
|
11
|
+
the same expiration days for all organizations in this platform). Warning:
|
|
12
|
+
empty values are also propagated'
|
|
13
|
+
census_tos_apply_all_tenants: 'Apply to all tenants (this will set the same
|
|
14
|
+
"Terms of service" for all organizations in this platform). Warning: empty
|
|
15
|
+
values are also propagated'
|
|
16
|
+
settings:
|
|
17
|
+
expiration_days: Expires in (days). If empty, defaults to %{days} days.
|
|
18
|
+
ine: Requester identifier (INE)
|
|
19
|
+
municipal_code: Municipal code
|
|
20
|
+
nif: NIF
|
|
21
|
+
organization_name: Public organization name
|
|
22
|
+
province_code: Province code
|
|
23
|
+
tos: Terms of service for consulting the census
|
|
24
|
+
tos_if_empty_html: 'If empty, the default terms of service will be extracted
|
|
25
|
+
from the I18n key <code>decidim.via_oberta.verifications.tos.content_html</code>.
|
|
26
|
+
Currently:'
|
|
27
|
+
via_oberta_handler:
|
|
28
|
+
document_type: 'Could not be obtained automatically. Please select one from
|
|
29
|
+
the list:'
|
|
30
|
+
decidim:
|
|
31
|
+
authorization_handlers:
|
|
32
|
+
trusted_ids_handler:
|
|
33
|
+
explanation: This authorization is granted to all users who use a login method
|
|
34
|
+
with a trusted identifier.
|
|
35
|
+
fields:
|
|
36
|
+
extra: Additional information
|
|
37
|
+
provider: Provider
|
|
38
|
+
uid: ID
|
|
39
|
+
name: Trusted identifier
|
|
40
|
+
via_oberta_handler:
|
|
41
|
+
explanation: This authorization is granted to all users who are in the Via
|
|
42
|
+
Oberta census database.
|
|
43
|
+
fields:
|
|
44
|
+
document_id: DNI/NIF
|
|
45
|
+
name: Via Oberta
|
|
46
|
+
events:
|
|
47
|
+
trusted_ids:
|
|
48
|
+
verifications:
|
|
49
|
+
invalid:
|
|
50
|
+
email_intro: It has not been possible to grant you the "%{handler_name}"
|
|
51
|
+
authorization.
|
|
52
|
+
email_outro: Please, contact the support at your platform to check what
|
|
53
|
+
has gone wrong.
|
|
54
|
+
email_subject: Authorization error
|
|
55
|
+
notification_title: Invalid authorization with the "%{handler_name}" method
|
|
56
|
+
ok:
|
|
57
|
+
email_intro: You have been granted the "%{handler_name}" authorization.
|
|
58
|
+
email_outro: You can now perform all actions that require the "%{handler_name}"
|
|
59
|
+
authorization.
|
|
60
|
+
email_subject: Authorization successful
|
|
61
|
+
notification_title: Successful authorization with the "%{handler_name}"
|
|
62
|
+
method
|
|
63
|
+
system:
|
|
64
|
+
organizations:
|
|
65
|
+
omniauth_settings:
|
|
66
|
+
icon_path: Icon path. If is empty, the default icon will be used.
|
|
67
|
+
valid:
|
|
68
|
+
client_id: Client ID
|
|
69
|
+
client_secret: Client secret
|
|
70
|
+
scope: Scope
|
|
71
|
+
site: Provider URL
|
|
72
|
+
trusted_ids:
|
|
73
|
+
devise:
|
|
74
|
+
sessions:
|
|
75
|
+
new:
|
|
76
|
+
login: Log in
|
|
77
|
+
login_subtitle: Log in to Decidim and participate.
|
|
78
|
+
unverified_login: Other unverified identification methods
|
|
79
|
+
verified_identity: Digital identity verified with %{provider}
|
|
80
|
+
verified_identity_html: |
|
|
81
|
+
<p>Access with systems recognized by official providers that certify your identity on the network, for more secure authentications.</p>
|
|
82
|
+
<ul>
|
|
83
|
+
<li>idCat Mòbil</li>
|
|
84
|
+
<li>idCat Certificat</li>
|
|
85
|
+
<li>DNIe</li>
|
|
86
|
+
<li>Cl@ve PIN</li>
|
|
87
|
+
</ul>
|
|
88
|
+
verified_login: Continue with verified identification
|
|
89
|
+
providers:
|
|
90
|
+
default:
|
|
91
|
+
description: This authorization is granted to all users who use a login
|
|
92
|
+
method with a trusted identifier.
|
|
93
|
+
name: Trusted identifier
|
|
94
|
+
valid:
|
|
95
|
+
description: VÀLid is a service that AOC provides to Catalan public administrations
|
|
96
|
+
to integrate the different available digital identification mechanisms (idCAT
|
|
97
|
+
Mòbil, digital certificates and Cl@ve).
|
|
98
|
+
name: VÀLid
|
|
99
|
+
sessions:
|
|
100
|
+
different_omniauth_emails: You are trying to sign in with a different email
|
|
101
|
+
than the one in your account. Please sign in with the same email or log
|
|
102
|
+
out and sign up directly to create a new user.
|
|
103
|
+
system:
|
|
104
|
+
settings: "%{handler} settings"
|
|
105
|
+
verifications:
|
|
106
|
+
form:
|
|
107
|
+
cancel: Cancel verification
|
|
108
|
+
description_html: In order to obtain this authorization, you need to verify
|
|
109
|
+
your identity with the %{provider} service. To do that, please click on
|
|
110
|
+
the "%{link}" button.<br><br>
|
|
111
|
+
error_provider_html: "<b>%{provider} is not available.</b> It seems that
|
|
112
|
+
this login/authorization method has not been enabled. Please contact the
|
|
113
|
+
support team to fix this."
|
|
114
|
+
warning_html: Please make sure that the email you have in this application
|
|
115
|
+
(<em>%{email}</em>) is the same as the one provided by the %{provider}
|
|
116
|
+
service. Otherwise the verification will fail.
|
|
117
|
+
verifications:
|
|
118
|
+
authorizations:
|
|
119
|
+
errors:
|
|
120
|
+
already_verified: You have already verified your identity with this method.
|
|
121
|
+
pending_authorization: This authorization method requires having the %{handler_name}
|
|
122
|
+
authorization previously granted.
|
|
123
|
+
first_login:
|
|
124
|
+
actions:
|
|
125
|
+
trusted_ids_generic: Verify with %{provider}
|
|
126
|
+
via_oberta_handler: Verify with Via Oberta
|
|
127
|
+
trusted_ids:
|
|
128
|
+
errors:
|
|
129
|
+
invalid_census: Could not verify you. The data provided to the census gateway
|
|
130
|
+
might not be valid.
|
|
131
|
+
invalid_id: Could not verify you. The document identifier is invalid or
|
|
132
|
+
not present in the census.
|
|
133
|
+
invalid_method: Could not verify you. OAuth2 verification method is not
|
|
134
|
+
supported.
|
|
135
|
+
invalid_status: Could not verify you. OAuth2 verification was not ok.
|
|
136
|
+
invalid_type: Could not verify you. The document type is invalid or not
|
|
137
|
+
present in the census.
|
|
138
|
+
no_identity: Could not verify you. OAuth2 verification did not return an
|
|
139
|
+
identification.
|
|
140
|
+
via_oberta:
|
|
141
|
+
verifications:
|
|
142
|
+
document_type:
|
|
143
|
+
nie: NIE
|
|
144
|
+
nif: NIF
|
|
145
|
+
others: Residence permit or others
|
|
146
|
+
passport: Passport
|
|
147
|
+
form:
|
|
148
|
+
code: 'Error code: %{code}'
|
|
149
|
+
data: 'Data that will be sent:'
|
|
150
|
+
description_html: <p>This authorization checks if you are in the <b>%{organization_name}</b>
|
|
151
|
+
census database.</p> <p>To perform this check, the following information
|
|
152
|
+
will be sent to the <a href="https://www.aoc.cat/serveis-aoc/via-oberta/"
|
|
153
|
+
target="_blank">Via Oberta Service</a>, provided by the <a href="https://www.aoc.cat"
|
|
154
|
+
target="_blank">Administració Oberta de Catalunya</a></p> <p>This information
|
|
155
|
+
will be used for the sole purpose of verifying your identity but records
|
|
156
|
+
of this transaction might be kept by the service provider.</p>
|
|
157
|
+
document_id: Document Number
|
|
158
|
+
document_type: Document type
|
|
159
|
+
error: 'Service error message:'
|
|
160
|
+
tos:
|
|
161
|
+
agreement: I accept the terms of use and service conditions
|
|
162
|
+
content_html: |
|
|
163
|
+
<p>In order to verify that you are registered as a person in the municipality, an automated query must be made through Via Oberta to the local data of the municipal population register.</p>
|
|
164
|
+
<ol>
|
|
165
|
+
<li>You can consult the specific data processing/protection policy at the <a href="https://www.aoc.cat/proteccio-dades/">following link</a></li>
|
|
166
|
+
<li>Do you give your consent?</li>
|
|
167
|
+
</ol>
|
|
168
|
+
title: Via Oberta terms of use and service
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
oc:
|
|
3
|
+
activemodel:
|
|
4
|
+
errors:
|
|
5
|
+
messages:
|
|
6
|
+
invalid_icon_path_format: deu aver lo format media/images/filename
|
|
7
|
+
icon_path_not_found: lo fichièr d'icòna existís pas dins los camins d'assets registrats
|
|
8
|
+
attributes:
|
|
9
|
+
trusted_ids_census_config:
|
|
10
|
+
census_expiration_apply_all_tenants: 'Aplicar a totes los "tenants" (aquò establís los meteisses jorns de caducitat per a totas las organizacions d''aquesta plataforma). Avís: los valors voids tanben se propagan'
|
|
11
|
+
census_tos_apply_all_tenants: 'Aplicar a totes los "tenants" (aquò establís los meteisses "Tèrmes d''usatge e condicions" per a totas las organizacions d''aquesta plataforma). Avís: los valors voids tanben se propagan'
|
|
12
|
+
settings:
|
|
13
|
+
expiration_days: Expira en (jorns). Se es void, los jorns per defaut son %{days}.
|
|
14
|
+
ine: Identificador del solicitant (INE)
|
|
15
|
+
municipal_code: Còdi municipal
|
|
16
|
+
nif: NIF
|
|
17
|
+
organization_name: Nom public de l'organizacion
|
|
18
|
+
province_code: Còdi de província
|
|
19
|
+
tos: Tèrmes d'usatge e servici per consultar lo cens
|
|
20
|
+
tos_if_empty_html: 'Se es void, las condicions del servici predeterminadas se tiraràn de la clau I18n <code>decidim.via_oberta.verifications.tos.content_html</code>. Actualament:'
|
|
21
|
+
via_oberta_handler:
|
|
22
|
+
document_type: 'Se pòt pas obténer automaticament. Seleccionatz-ne un de la lista:'
|
|
23
|
+
decidim:
|
|
24
|
+
authorization_handlers:
|
|
25
|
+
trusted_ids_handler:
|
|
26
|
+
explanation: Aquesta autorizacion s'atorga a totes los utilizaires que utilizan un metòde d'inici de session amb identificador fidedigne.
|
|
27
|
+
fields:
|
|
28
|
+
extra: Informacion addicionala
|
|
29
|
+
provider: Provesidor
|
|
30
|
+
uid: ID
|
|
31
|
+
name: Identificador fidedigne
|
|
32
|
+
via_oberta_handler:
|
|
33
|
+
explanation: Aquesta autorizacion s'atorga a totes los utilizaires que son dins la basa de donadas del cens de Via Oberta.
|
|
34
|
+
fields:
|
|
35
|
+
document_id: DNI/NIF
|
|
36
|
+
name: Via Oberta
|
|
37
|
+
events:
|
|
38
|
+
trusted_ids:
|
|
39
|
+
verifications:
|
|
40
|
+
invalid:
|
|
41
|
+
email_intro: Es pas estat possible de vos concedir l'autorizacion "%{handler_name}".
|
|
42
|
+
email_outro: Se vos plai, metètz-vos en contacte amb lo supòrt de la plataforma per comprovar l'error que s'es produch.
|
|
43
|
+
email_subject: Error d'autorizacion
|
|
44
|
+
notification_title: Autorizacion pas valida amb lo metòde "%{handler_name}"
|
|
45
|
+
ok:
|
|
46
|
+
email_intro: Se vos a concedit l'autorizacion "%{handler_name}".
|
|
47
|
+
email_outro: Ara podètz realizar totas las accions que requerisson l'autorizacion "%{handler_name}".
|
|
48
|
+
email_subject: S'es autorizat corrèctament
|
|
49
|
+
notification_title: Autorizacion corrècta amb lo metòde "%{handler_name}"
|
|
50
|
+
system:
|
|
51
|
+
organizations:
|
|
52
|
+
omniauth_settings:
|
|
53
|
+
valid:
|
|
54
|
+
client_id: Client ID
|
|
55
|
+
client_secret: Clau secreta del client
|
|
56
|
+
icon_path: Icòna. Se es void, l'icòna per defaut serà utilizat.
|
|
57
|
+
scope: Encastre
|
|
58
|
+
site: URL del provesidor
|
|
59
|
+
trusted_ids:
|
|
60
|
+
devise:
|
|
61
|
+
sessions:
|
|
62
|
+
new:
|
|
63
|
+
login: Iniciatz la session
|
|
64
|
+
login_subtitle: Iniciatz la session a Decidim e participatz.
|
|
65
|
+
unverified_login: Autres metòdes d'identificacion pas verificada
|
|
66
|
+
verified_identity: Identificacion digitala verificada amb %{provider}
|
|
67
|
+
verified_identity_html: |
|
|
68
|
+
<p>Accedissètz amb de sistèmas reconeguts per de provesidors oficials que acreditan vòstra identitat sus la ret, per d'autenticacions mai seguras.</p>
|
|
69
|
+
<ul>
|
|
70
|
+
<li>idCat Mòbil</li>
|
|
71
|
+
<li>idCat Certificat</li>
|
|
72
|
+
<li>DNIe</li>
|
|
73
|
+
<li>Cl@ve PIN</li>
|
|
74
|
+
</ul>
|
|
75
|
+
verified_login: Contunhar amb identificacion verificada
|
|
76
|
+
providers:
|
|
77
|
+
default:
|
|
78
|
+
description: Aquesta autorizacion s'atorga a totes los utilizaires que utilizan un metòde d'inici de session amb identificador fidedigne.
|
|
79
|
+
name: Identificador fidedigne
|
|
80
|
+
valid:
|
|
81
|
+
description: VÀLid es un servici que l'AOC met a disposicion de las administracions publicas catalanas amb la finalitat d'integrar los diferents mecanismes d'identificacion digitala disponibles (idCAT Mòbil, certificats digitals e Cl@ve).
|
|
82
|
+
name: VÀLid
|
|
83
|
+
sessions:
|
|
84
|
+
different_omniauth_emails: Sètz a ensajar d'iniciar la session amb una adreça electronica diferenta de la de vòstre compte. Accedissètz amb la meteissa adreça electronica o tampatz la session e enregistratz-vos amb lo boton dirècte per crear un utilizaire novèl.
|
|
85
|
+
system:
|
|
86
|
+
settings: "configuracion de %{handler}"
|
|
87
|
+
verifications:
|
|
88
|
+
form:
|
|
89
|
+
cancel: Anullar la verificacion
|
|
90
|
+
description_html: Per obténer aquesta autorizacion, vos cal verificar vòstra identitat amb lo servici %{provider}. Per aquò, clicatz sul boton "%{link}".<br><br>
|
|
91
|
+
error_provider_html: "<b>%{provider} es pas disponible.</b> Sembla que aqueste metòde d'inici de session/autorizacion es pas estat activat. Metètz-vos en contacte amb lo supòrt de la plataforma per o resòlvre."
|
|
92
|
+
warning_html: Asseguratz-vos que l'adreça electronica qu'avètz dins aquesta aplicacion (<em>%{email}</em>) siá la meteissa que la que vos provesís lo servici %{provider}. Se non, la verificacion fracassarà.
|
|
93
|
+
verifications:
|
|
94
|
+
authorizations:
|
|
95
|
+
errors:
|
|
96
|
+
already_verified: Ja avètz verificat vòstra identitat amb aqueste metòde.
|
|
97
|
+
pending_authorization: Aqueste metòde d'autorizacion requerís d'aver prealablament l'autorizacion %{handler_name}.
|
|
98
|
+
first_login:
|
|
99
|
+
actions:
|
|
100
|
+
trusted_ids_generic: Verificatz-vos amb %{provider}
|
|
101
|
+
via_oberta_handler: Verificatz-vos amb Via Oberta
|
|
102
|
+
trusted_ids:
|
|
103
|
+
errors:
|
|
104
|
+
invalid_census: Se pòt pas verificar. Es possible que las donadas provesidas a la passarela del cens sián pas validas.
|
|
105
|
+
invalid_id: Se pòt pas verificar. L'identificador del document es pas valid o se tròba pas dins lo cens.
|
|
106
|
+
invalid_method: Vos avètz pas pogut verificar. Lo metòde de verificacion OAuth2 es pas suportat.
|
|
107
|
+
invalid_status: Vos avètz pas pogut verificar. La verificacion OAuth2 es estada incorrècta.
|
|
108
|
+
invalid_type: Se pòt pas verificar. Lo tipe de document es pas valid o es pas dins lo cens.
|
|
109
|
+
no_identity: Se pòt pas verificar. La verificacion OAuth2 a pas retornat cap d'identificacion.
|
|
110
|
+
via_oberta:
|
|
111
|
+
verifications:
|
|
112
|
+
document_type:
|
|
113
|
+
nie: NIE
|
|
114
|
+
nif: NIF
|
|
115
|
+
others: Permés de residéncia o autres
|
|
116
|
+
passport: Passapòrt
|
|
117
|
+
form:
|
|
118
|
+
code: 'Còdi d''error: %{code}'
|
|
119
|
+
data: 'Donadas que s''enviaràn:'
|
|
120
|
+
description_html: <p>Aquesta autorizacion verifica se sètz dins la basa de donadas del cens <b>%{organization_name}</b>.</p> <p>Per realizar aquesta comprovacion, s'enviarà l'informacion seguenta al <a href="https://www.aoc.cat/serveis-aoc/via-oberta/" target="_blank">Servici Via Oberta</a>, provesit per l'<a href="https://www.aoc.cat" target="_blank">Administració Oberta de Catalunya</a></p> <p>Aquesta informacion serà utilizada amb l'unic objectiu de verificar vòstra identitat, mas los registres d'aquesta transaccion pòdon èsser conservats pel provesidor de servicis.</p>
|
|
121
|
+
document_id: Numèro de document
|
|
122
|
+
document_type: Tipe de document
|
|
123
|
+
error: 'Messatge d''error del servici:'
|
|
124
|
+
tos:
|
|
125
|
+
agreement: Accepti los tèrmes d'usatge e condicions del servici
|
|
126
|
+
content_html: |
|
|
127
|
+
<p>Per poder verificar que constatz coma persona empadronada al municipi, cal far una consulta automatizada mejançant Via Oberta a las donadas localas del padrón municipal d'abitants.</p>
|
|
128
|
+
<ol>
|
|
129
|
+
<li>Podètz consultar la politica concreta de tractament/proteccion de donadas al <a href="https://www.aoc.cat/proteccio-dades/">ligam seguent</a></li>
|
|
130
|
+
<li>Balhatz vòstre consentiment?</li>
|
|
131
|
+
</ol>
|
|
132
|
+
title: Tèrmes d'usatge e servici Via Oberta
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
handler = {
|
|
4
|
+
decidim: {
|
|
5
|
+
authorization_handlers: {
|
|
6
|
+
trusted_ids_handler: {
|
|
7
|
+
name: lambda { |_key, _options|
|
|
8
|
+
I18n.t("decidim.trusted_ids.providers.#{Decidim::TrustedIds.omniauth_provider}.name",
|
|
9
|
+
default: I18n.t("decidim.trusted_ids.providers.default.name"))
|
|
10
|
+
},
|
|
11
|
+
explanation: lambda { |_key, _options|
|
|
12
|
+
I18n.t("decidim.trusted_ids.providers.#{Decidim::TrustedIds.omniauth_provider}.description",
|
|
13
|
+
default: I18n.t("decidim.trusted_ids.providers.default.description"))
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
trusted_ids_census_handler: {
|
|
17
|
+
name: lambda { |_key, _options|
|
|
18
|
+
I18n.t("decidim.authorization_handlers.#{Decidim::TrustedIds.census_authorization[:handler]}.name",
|
|
19
|
+
default: Decidim::TrustedIds.census_authorization[:handler])
|
|
20
|
+
},
|
|
21
|
+
explanation: lambda { |_key, _options|
|
|
22
|
+
I18n.t("decidim.authorization_handlers.#{Decidim::TrustedIds.census_authorization[:handler]}.description",
|
|
23
|
+
default: Decidim::TrustedIds.census_authorization[:handler])
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
verifications: {
|
|
28
|
+
authorizations: {
|
|
29
|
+
first_login: {
|
|
30
|
+
actions: {
|
|
31
|
+
trusted_ids_handler: lambda { |_key, _options|
|
|
32
|
+
I18n.t("decidim.verifications.authorizations.first_login.actions.trusted_ids_generic",
|
|
33
|
+
provider: I18n.t("decidim.trusted_ids.providers.#{Decidim::TrustedIds.omniauth_provider}.name",
|
|
34
|
+
default: I18n.t("decidim.trusted_ids.providers.default.name")))
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Decidim.available_locales.index_with do |_locale|
|
|
44
|
+
handler
|
|
45
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateOrganizationTrustedIdsConfig < ActiveRecord::Migration[6.0]
|
|
4
|
+
def change
|
|
5
|
+
create_table :organization_trusted_ids_configs do |t|
|
|
6
|
+
t.integer :decidim_organization_id, null: false, index: { name: "index_decidim_trusted_ids_organization" }
|
|
7
|
+
t.string :handler
|
|
8
|
+
t.jsonb :settings, null: false, default: {}
|
|
9
|
+
t.integer :expiration_days
|
|
10
|
+
t.jsonb :tos, null: false, default: {}
|
|
11
|
+
t.timestamps
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "omniauth/strategies"
|
|
4
|
+
require "deface"
|
|
5
|
+
|
|
6
|
+
module Decidim
|
|
7
|
+
module TrustedIds
|
|
8
|
+
# This is the engine that runs on the public interface of trusted_ids.
|
|
9
|
+
class Engine < ::Rails::Engine
|
|
10
|
+
isolate_namespace Decidim::TrustedIds
|
|
11
|
+
|
|
12
|
+
config.to_prepare do
|
|
13
|
+
# Non-controller overrides here
|
|
14
|
+
Decidim::Organization.include(Decidim::TrustedIds::OrganizationOverride)
|
|
15
|
+
Decidim::Authorization.include(Decidim::TrustedIds::AuthorizationOverride)
|
|
16
|
+
Decidim::System::RegisterOrganizationForm.include(Decidim::TrustedIds::System::OrganizationFormOverride)
|
|
17
|
+
Decidim::System::UpdateOrganizationForm.include(Decidim::TrustedIds::System::OrganizationFormOverride)
|
|
18
|
+
Decidim::System::UpdateOrganization.include(Decidim::TrustedIds::System::UpdateOrganizationOverride)
|
|
19
|
+
Decidim::System::CreateOrganization.include(Decidim::TrustedIds::System::CreateOrganizationOverride)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
initializer "decidim_trusted_ids.controller_addons", after: "decidim.action_controller" do
|
|
23
|
+
config.to_prepare do
|
|
24
|
+
# Adds some global css/javascript to the application
|
|
25
|
+
Decidim::Devise::SessionsController.include(Decidim::TrustedIds::NeedsTrustedIdsSnippets)
|
|
26
|
+
Decidim::Devise::OmniauthRegistrationsController.include(Decidim::TrustedIds::CheckOmniauthEmailOnLogin)
|
|
27
|
+
Decidim::Verifications::AuthorizationsController.include(Decidim::TrustedIds::NeedsTrustedIdsSnippets)
|
|
28
|
+
Decidim::Verifications::AuthorizationsController.include(Decidim::TrustedIds::CheckExistingAuthorizations)
|
|
29
|
+
Decidim::Admin::ImpersonationsController.include(Decidim::TrustedIds::Admin::ImpersonationsControllerOverride)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# This initializer is used to configure using ENV variables
|
|
34
|
+
# Done here to make it compatible with gems like dotenv-rails/figaro/figjam that load configur is initialized
|
|
35
|
+
initializer "decidim_trusted_ids.configuration" do
|
|
36
|
+
set_default = lambda do |attribute, value|
|
|
37
|
+
Decidim::TrustedIds.public_send(attribute).nil? &&
|
|
38
|
+
Decidim::TrustedIds.public_send("#{attribute}=", value)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
set_default.call(
|
|
42
|
+
:omniauth_provider,
|
|
43
|
+
ENV.fetch("OMNIAUTH_PROVIDER", "valid")
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
set_default.call(
|
|
47
|
+
:authorization_metadata,
|
|
48
|
+
Decidim::TrustedIds.omniauth_metadata_attributes || {
|
|
49
|
+
expires_at: [:credentials, :expires_at],
|
|
50
|
+
identifier_type: [:extra, :identifier_type],
|
|
51
|
+
method: [:extra, :method],
|
|
52
|
+
assurance_level: [:extra, :assurance_level]
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
set_default.call(
|
|
57
|
+
:omniauth,
|
|
58
|
+
{
|
|
59
|
+
enabled: Decidim::TrustedIds.to_bool(
|
|
60
|
+
ENV.fetch(
|
|
61
|
+
"OMNIAUTH_ENABLED_BY_DEFAULT",
|
|
62
|
+
Decidim::TrustedIds.omniauth_env("CLIENT_ID").present?
|
|
63
|
+
)
|
|
64
|
+
),
|
|
65
|
+
client_id: Decidim::TrustedIds.omniauth_env("CLIENT_ID"),
|
|
66
|
+
client_secret: Decidim::TrustedIds.omniauth_env("CLIENT_SECRET"),
|
|
67
|
+
site: Decidim::TrustedIds.omniauth_env("SITE", "https://valid.aoc.cat"),
|
|
68
|
+
icon_path: Decidim::TrustedIds.omniauth_env(
|
|
69
|
+
"ICON",
|
|
70
|
+
"media/images/#{Decidim::TrustedIds.omniauth_provider.downcase}-icon.png"
|
|
71
|
+
),
|
|
72
|
+
scope: Decidim::TrustedIds.omniauth_env("SCOPE", "autenticacio_usuari")
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
set_default.call(
|
|
77
|
+
:omniauth_global_attributes,
|
|
78
|
+
ENV.fetch("OMNIAUTH_GLOBAL_ATTRIBUTES", "site scope").split.map(&:to_sym)
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
set_default.call(
|
|
82
|
+
:custom_login_screen,
|
|
83
|
+
Decidim::TrustedIds.to_bool(
|
|
84
|
+
ENV.fetch("CUSTOM_LOGIN_SCREEN", true)
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
set_default.call(
|
|
89
|
+
:verification_expiration_time,
|
|
90
|
+
ENV.fetch("VERIFICATION_EXPIRATION_TIME", 90).to_i.days
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
set_default.call(
|
|
94
|
+
:send_verification_notifications,
|
|
95
|
+
if ENV.has_key?("SEND_VERIFICATION_NOTIFICATIONS")
|
|
96
|
+
Decidim::TrustedIds.to_bool(ENV.fetch("SEND_VERIFICATION_NOTIFICATIONS"))
|
|
97
|
+
else
|
|
98
|
+
true
|
|
99
|
+
end
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
set_default.call(
|
|
103
|
+
:census_authorization,
|
|
104
|
+
{
|
|
105
|
+
handler: if ENV.has_key?("CENSUS_AUTHORIZATION_HANDLER")
|
|
106
|
+
ENV.fetch("CENSUS_AUTHORIZATION_HANDLER").to_sym
|
|
107
|
+
else
|
|
108
|
+
:via_oberta_handler
|
|
109
|
+
end,
|
|
110
|
+
form: ENV.fetch(
|
|
111
|
+
"CENSUS_AUTHORIZATION_FORM",
|
|
112
|
+
"Decidim::ViaOberta::Verifications::ViaObertaHandler"
|
|
113
|
+
),
|
|
114
|
+
env: ENV.fetch("CENSUS_AUTHORIZATION_ENV", "production"),
|
|
115
|
+
api_url: ENV.fetch("CENSUS_AUTHORIZATION_API_URL", nil),
|
|
116
|
+
system_attributes: ENV.fetch(
|
|
117
|
+
"CENSUS_AUTHORIZATION_SYSTEM_ATTRIBUTES",
|
|
118
|
+
"nif ine municipal_code province_code organization_name"
|
|
119
|
+
).split
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
initializer "decidim_trusted_ids.omniauth" do
|
|
125
|
+
omniauth = Decidim::TrustedIds.omniauth
|
|
126
|
+
next unless omniauth && Decidim::TrustedIds.omniauth_provider.present?
|
|
127
|
+
|
|
128
|
+
omniauth[:icon_path] = "media/images/#{Decidim::TrustedIds.omniauth_provider.downcase}-icon.png" if omniauth[:icon_path].blank?
|
|
129
|
+
omniauth[:scope] = "autenticacio_usuari" if omniauth[:scope].blank?
|
|
130
|
+
|
|
131
|
+
global_attributes = Decidim::TrustedIds.omniauth_global_attributes
|
|
132
|
+
# Decidim configuration decide whether to show the omniauth provider
|
|
133
|
+
Decidim.omniauth_providers[Decidim::TrustedIds.omniauth_provider.to_sym] = omniauth.except(*global_attributes)
|
|
134
|
+
|
|
135
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
|
136
|
+
provider Decidim::TrustedIds.omniauth_provider,
|
|
137
|
+
setup: lambda { |env|
|
|
138
|
+
request = Rack::Request.new(env)
|
|
139
|
+
organization = Decidim::Organization.find_by(host: request.host)
|
|
140
|
+
provider_config = organization.omniauth_settings&.filter_map do |key, value|
|
|
141
|
+
next unless key.start_with?("omniauth_settings_#{Decidim::TrustedIds.omniauth_provider}")
|
|
142
|
+
|
|
143
|
+
attribute = Decidim::OmniauthProvider.extract_setting_key(key, Decidim::TrustedIds.omniauth_provider)
|
|
144
|
+
[attribute, value.presence ? Decidim::AttributeEncryptor.decrypt(value) : omniauth[attribute]]
|
|
145
|
+
end.to_h
|
|
146
|
+
|
|
147
|
+
omniauth.each do |key, value|
|
|
148
|
+
env["omniauth.strategy"].options[key] = provider_config[key].presence || value
|
|
149
|
+
end
|
|
150
|
+
}
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
initializer "decidim_trusted_ids.authorizations" do
|
|
155
|
+
# Triggers user verification after login/registration
|
|
156
|
+
ActiveSupport::Notifications.subscribe(/decidim\.user\.omniauth_(registration|login)/) do |_name, data|
|
|
157
|
+
Decidim::TrustedIds::OmniauthVerificationJob.perform_later(data)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Generic verification method for the integrated OAuth mechanism
|
|
161
|
+
Decidim::Verifications.register_workflow(:trusted_ids_handler) do |workflow|
|
|
162
|
+
workflow.form = "Decidim::TrustedIds::Verifications::TrustedIdsHandler"
|
|
163
|
+
workflow.expires_in = Decidim::TrustedIds.verification_expiration_time.to_i
|
|
164
|
+
end
|
|
165
|
+
# Census verification
|
|
166
|
+
if Decidim::TrustedIds.census_authorization[:handler].present?
|
|
167
|
+
Decidim::Verifications.register_workflow(Decidim::TrustedIds.census_authorization[:handler].to_sym) do |workflow|
|
|
168
|
+
workflow.form = Decidim::TrustedIds.census_authorization[:form]
|
|
169
|
+
workflow.expires_in = Decidim::TrustedIds.verification_expiration_time.to_i
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
Decidim.icons.register(name: "valid-fill", icon: "valid-fill", category: "social icon", description: "", engine: :core)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
initializer "decidim_trusted_ids.webpacker.assets_path" do
|
|
177
|
+
Decidim.register_assets_path File.expand_path("app/packs", root)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "decidim/core/test/factories"
|
|
4
|
+
require "decidim/system/test/factories"
|
|
5
|
+
|
|
6
|
+
FactoryBot.define do
|
|
7
|
+
factory :trusted_ids_organization_config, class: "Decidim::TrustedIds::OrganizationConfig" do
|
|
8
|
+
organization
|
|
9
|
+
handler { "via_oberta_handler" }
|
|
10
|
+
settings do
|
|
11
|
+
{
|
|
12
|
+
nif: "12345678Z",
|
|
13
|
+
ine: "123456789",
|
|
14
|
+
municipal_code: "9999",
|
|
15
|
+
province_code: "08"
|
|
16
|
+
}
|
|
17
|
+
end
|
|
18
|
+
expiration_days { 30 }
|
|
19
|
+
tos { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "decidim/trusted_ids/verifications"
|
|
4
|
+
require "decidim/trusted_ids/engine"
|
|
5
|
+
|
|
6
|
+
module Decidim
|
|
7
|
+
module TrustedIds
|
|
8
|
+
include ActiveSupport::Configurable
|
|
9
|
+
|
|
10
|
+
def self.omniauth_env(key, default = nil)
|
|
11
|
+
ENV.fetch("#{TrustedIds.omniauth_provider.upcase}_#{key}", default)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.to_bool(val)
|
|
15
|
+
ActiveRecord::Type::Boolean.new.deserialize(val.to_s.downcase)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.omniauth_metadata_attributes
|
|
19
|
+
valid_keys = ENV.keys.filter { |key| key.starts_with?("#{TrustedIds.omniauth_provider.upcase}_METADATA_") }
|
|
20
|
+
return nil if valid_keys.blank?
|
|
21
|
+
|
|
22
|
+
valid_keys.to_h do |key|
|
|
23
|
+
[key.gsub("#{TrustedIds.omniauth_provider.upcase}_METADATA_", "").downcase.to_sym, ENV[key].split.map(&:to_sym)]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# The name of the omniauth provider, must be registered in Decidim.
|
|
28
|
+
# Leave it empty to disable omniauth authentication.
|
|
29
|
+
config_accessor :omniauth_provider
|
|
30
|
+
|
|
31
|
+
# From the data obtained we extract metadata to be saved as part of the authorization
|
|
32
|
+
# This data can later be used by the census_authorization handler as to call the webservice
|
|
33
|
+
# A hash with keys and how to find it inside hash comming from the OAuth
|
|
34
|
+
config_accessor :authorization_metadata
|
|
35
|
+
|
|
36
|
+
# setup a hash with :client_id, :client_secret and :site to enable omniauth authentication
|
|
37
|
+
config_accessor :omniauth
|
|
38
|
+
|
|
39
|
+
# which of the former attributes can not set a the /system configuration, there are all the same for all tenants
|
|
40
|
+
config_accessor :omniauth_global_attributes
|
|
41
|
+
|
|
42
|
+
# wheter to use a custom login screen or the default one
|
|
43
|
+
config_accessor :custom_login_screen
|
|
44
|
+
|
|
45
|
+
# how long the verification will be valid, defaults to 90 days
|
|
46
|
+
# if empty or nil, the verification will never expire
|
|
47
|
+
config_accessor :verification_expiration_time
|
|
48
|
+
|
|
49
|
+
# if false, no notifications will be send to users when automatic verifications are performed
|
|
50
|
+
config_accessor :send_verification_notifications
|
|
51
|
+
|
|
52
|
+
# Linked authorization method that will automatically verify users after getting a valid TrustedIds verification
|
|
53
|
+
config_accessor :census_authorization
|
|
54
|
+
|
|
55
|
+
def self.census_config_attributes
|
|
56
|
+
return [] if TrustedIds.census_authorization[:handler].blank?
|
|
57
|
+
return [] if TrustedIds.census_authorization[:system_attributes].blank?
|
|
58
|
+
return [] unless TrustedIds.census_authorization[:system_attributes].is_a?(Array)
|
|
59
|
+
|
|
60
|
+
TrustedIds.census_authorization[:system_attributes].map do |prop|
|
|
61
|
+
[prop.to_sym, String]
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.custom_login_screen?
|
|
66
|
+
Decidim::TrustedIds.omniauth_provider.present? && Decidim::TrustedIds.custom_login_screen.present?
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|