decidim-idcat_mobil 0.7.2 → 0.9.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 +24 -7
- data/config/assets.rb +3 -3
- data/config/initializers/omniauth_idcat_mobil.rb +5 -5
- data/lib/decidim/idcat_mobil/engine.rb +13 -0
- data/lib/decidim/idcat_mobil/version.rb +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cb3c12809255d23783dcf206ccc4f8231108f0a1d51f09e7ad0c8e85dd258557
|
|
4
|
+
data.tar.gz: 0df3dedb54dd2ab2970ca0b9dae8300977a679033475a6baa86f52f966d245c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d7c66f4270daef1c8f9c29d930aed3682ad130e8dc8fe7d21b8177e0e51262a72f35ce89da3ecff6c6f745f55015442c620116dac8ffb2ee85984b4e78625dd8
|
|
7
|
+
data.tar.gz: e2e8e213bf5a3f089fb27befc86fefadaed635d0dddde2b2668e99d97b63bcb467dd7e980ed13a6b6a17bf9a06d3c7b4c4b0addc59fbdee750dc63ef96057f4e
|
data/README.md
CHANGED
|
@@ -32,16 +32,33 @@ To use it you have to first configure the omniauth-idcat_mobil.
|
|
|
32
32
|
|
|
33
33
|
### omniauth-idcat_mobil configuration
|
|
34
34
|
`IdCat mòbil` will be available as a configurable OAuth2 strategy.
|
|
35
|
-
Check how
|
|
35
|
+
Check how social providers work in [Decidim's related documentation](https://docs.decidim.org/en/develop/services/social_providers).
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
Since Decidim 0.31, OmniAuth providers are no longer configured in `config/secrets.yml`. This module registers the `idcat_mobil` provider in `Decidim.omniauth_providers` automatically, so you only have to set these environment variables:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
IDCAT_MOBIL_CLIENT_ID=your-client-id
|
|
41
|
+
IDCAT_MOBIL_CLIENT_SECRET=your-client-secret
|
|
42
|
+
IDCAT_MOBIL_SITE_URL=https://your-valid-site-url
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The provider is enabled when `IDCAT_MOBIL_CLIENT_ID` is present. The credentials can also be set (or overridden) per organization from the system panel (`/system`).
|
|
46
|
+
|
|
47
|
+
If you need a custom configuration, define the provider in your app's `config/initializers/decidim.rb`. The module will not overwrite it:
|
|
48
|
+
|
|
49
|
+
```ruby
|
|
50
|
+
Decidim.configure do |config|
|
|
51
|
+
config.omniauth_providers[:idcat_mobil] = {
|
|
52
|
+
enabled: true,
|
|
53
|
+
client_id: ENV.fetch("IDCAT_MOBIL_CLIENT_ID", nil),
|
|
54
|
+
client_secret: ENV.fetch("IDCAT_MOBIL_CLIENT_SECRET", nil),
|
|
55
|
+
site_url: ENV.fetch("IDCAT_MOBIL_SITE_URL", nil),
|
|
56
|
+
icon_path: "media/images/idcat_mobil-icon.svg"
|
|
57
|
+
}
|
|
58
|
+
end
|
|
42
59
|
```
|
|
43
60
|
|
|
44
|
-
|
|
61
|
+
Note: if your app replaces the whole hash (`config.omniauth_providers = { ... }`), you must include the `idcat_mobil` key there too, or the provider will be removed.
|
|
45
62
|
|
|
46
63
|
|
|
47
64
|
Refer to `omniauth-idcat_mobil` gem for further documentation.
|
data/config/assets.rb
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
base_path = File.expand_path("..", __dir__)
|
|
6
6
|
|
|
7
|
-
# Register the additonal path for
|
|
7
|
+
# Register the additonal path for Shakapacker in order to make the module's
|
|
8
8
|
# stylesheets available for inclusion.
|
|
9
|
-
Decidim::
|
|
9
|
+
Decidim::Shakapacker.register_path("#{base_path}/app/packs")
|
|
10
10
|
|
|
11
11
|
# Register the main application's stylesheet include statement:
|
|
12
12
|
# Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/your_component/your_component")
|
|
13
13
|
# Register the admin panel's stylesheet include statement:
|
|
14
14
|
|
|
15
15
|
# Register JS entrypoints
|
|
16
|
-
Decidim::
|
|
16
|
+
Decidim::Shakapacker.register_entrypoints(decidim_idcat_mobil: "#{base_path}/app/packs/entrypoints/decidim-idcat_mobil.js")
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
OmniAuth.config.logger = Rails.logger
|
|
4
4
|
|
|
5
|
-
if
|
|
5
|
+
if Decidim.omniauth_providers[:idcat_mobil]
|
|
6
6
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
|
7
7
|
provider(
|
|
8
8
|
:idcat_mobil,
|
|
9
9
|
setup: lambda { |env|
|
|
10
10
|
request = Rack::Request.new(env)
|
|
11
11
|
organization = Decidim::Organization.find_by(host: request.host)
|
|
12
|
-
provider_config = organization
|
|
13
|
-
env["omniauth.strategy"].options[:client_id] = provider_config[:client_id] || ENV.fetch("IDCAT_MOBIL_CLIENT_ID", nil)
|
|
14
|
-
env["omniauth.strategy"].options[:client_secret] = provider_config[:client_secret] || ENV.fetch("IDCAT_MOBIL_CLIENT_SECRET", nil)
|
|
15
|
-
env["omniauth.strategy"].options[:site] = provider_config[:site_url] || ENV.fetch("IDCAT_MOBIL_SITE_URL", nil)
|
|
12
|
+
provider_config = organization&.enabled_omniauth_providers&.dig(:idcat_mobil) || {}
|
|
13
|
+
env["omniauth.strategy"].options[:client_id] = provider_config[:client_id].presence || ENV.fetch("IDCAT_MOBIL_CLIENT_ID", nil)
|
|
14
|
+
env["omniauth.strategy"].options[:client_secret] = provider_config[:client_secret].presence || ENV.fetch("IDCAT_MOBIL_CLIENT_SECRET", nil)
|
|
15
|
+
env["omniauth.strategy"].options[:site] = provider_config[:site_url].presence || ENV.fetch("IDCAT_MOBIL_SITE_URL", nil)
|
|
16
16
|
},
|
|
17
17
|
scope: :autenticacio_usuari
|
|
18
18
|
)
|
|
@@ -16,6 +16,19 @@ module Decidim
|
|
|
16
16
|
# root to: "idcat_mobil#index"
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
# Since Decidim 0.31 OmniAuth providers are no longer read from secrets.yml,
|
|
20
|
+
# they must be registered in `Decidim.omniauth_providers`. This registers
|
|
21
|
+
# IdCat mòbil with defaults from ENV, unless the app already configured it.
|
|
22
|
+
initializer "decidim_idcat_mobil.omniauth_provider", before: :load_config_initializers do
|
|
23
|
+
Decidim.omniauth_providers[:idcat_mobil] ||= {
|
|
24
|
+
enabled: ENV["IDCAT_MOBIL_CLIENT_ID"].present?,
|
|
25
|
+
client_id: ENV.fetch("IDCAT_MOBIL_CLIENT_ID", nil),
|
|
26
|
+
client_secret: ENV.fetch("IDCAT_MOBIL_CLIENT_SECRET", nil),
|
|
27
|
+
site_url: ENV.fetch("IDCAT_MOBIL_SITE_URL", nil),
|
|
28
|
+
icon_path: "media/images/idcat_mobil-icon.svg"
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
19
32
|
initializer "decidim_valid.authorizations" do
|
|
20
33
|
# Triggers user verification after login/registration
|
|
21
34
|
ActiveSupport::Notifications.subscribe "decidim.user.omniauth_registration" do |_name, data|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: decidim-idcat_mobil
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Oliver Valls
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: decidim
|
|
@@ -16,28 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
19
|
+
version: 0.31.8
|
|
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: 0.
|
|
26
|
+
version: 0.31.8
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: decidim-core
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.
|
|
33
|
+
version: 0.31.8
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.
|
|
40
|
+
version: 0.31.8
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: omniauth-idcat_mobil
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -102,14 +102,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
102
102
|
requirements:
|
|
103
103
|
- - ">="
|
|
104
104
|
- !ruby/object:Gem::Version
|
|
105
|
-
version: 3.
|
|
105
|
+
version: 3.3.4
|
|
106
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
108
|
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
111
|
requirements: []
|
|
112
|
-
rubygems_version: 3.
|
|
112
|
+
rubygems_version: 3.5.11
|
|
113
113
|
signing_key:
|
|
114
114
|
specification_version: 4
|
|
115
115
|
summary: A decidim idcat_mobil module
|