diff --git a/.env-example b/.env-example new file mode 100644 index 0000000..51c7c36 --- /dev/null +++ b/.env-example @@ -0,0 +1,42 @@ +DATABASE_NAME=osp_app +# DATABASE_USERNAME= +# DATABASE_PASSWORD= +DATABASE_HOST=localhost +DATABASE_PORT=5432 +# bundle exec rake secret +SECRET_KEY_BASE= +ASSET_HOST= +# THROTTLING_MAX_REQUESTS - Integer - Number of requests per ip +THROTTLING_MAX_REQUESTS=100 +# THROTTLING_PERIOD - Integer - Period for each IP in minutes +THROTTLING_PERIOD=1 +# ENABLE_RACK_ATTACK - Binary (Default 1) - Enable or Disable Rack Attack +# ENABLE_RACK_ATTACK=0 +ENABLE_RACK_ATTACK=1 +# Omniauth +# OMNIAUTH_ENABLE_MULTI_TENANT - Binary (Default 1) - Enable or Disable Omniauth multitenant setup +# OMNIAUTH_ENABLE_MULTI_TENANT=0 +OMNIAUTH_ENABLE_MULTI_TENANT=1 +# If OMNIAUTH_ENABLE_MULTI_TENANT is enabled these variables will not be taken into account +## France Connect UID +OMNIAUTH_FRANCE_CONNECT_UID_ENABLED=0 +OMNIAUTH_FRANCE_CONNECT_UID_ICON_PATH= +OMNIAUTH_FRANCE_CONNECT_UID_BUTTON_PATH= +OMNIAUTH_FRANCE_CONNECT_UID_PROVIDER_NAME= +OMNIAUTH_FRANCE_CONNECT_UID_SITE= +OMNIAUTH_FRANCE_CONNECT_UID_CLIENT_ID= +OMNIAUTH_FRANCE_CONNECT_UID_CLIENT_SECRET= +OMNIAUTH_FRANCE_CONNECT_UID_END_SESSION_ENDPOINT= +OMNIAUTH_FRANCE_CONNECT_UID_MINIMUM_AGE= +## France Connect PROFILE +OMNIAUTH_FRANCE_CONNECT_PROFILE_ENABLED=0 +OMNIAUTH_FRANCE_CONNECT_PROFILE_ICON_PATH= +OMNIAUTH_FRANCE_CONNECT_PROFILE_BUTTON_PATH= +OMNIAUTH_FRANCE_CONNECT_PROFILE_PROVIDER_NAME= +OMNIAUTH_FRANCE_CONNECT_PROFILE_SITE= +OMNIAUTH_FRANCE_CONNECT_PROFILE_CLIENT_ID= +OMNIAUTH_FRANCE_CONNECT_PROFILE_CLIENT_SECRET= +OMNIAUTH_FRANCE_CONNECT_PROFILE_END_SESSION_ENDPOINT= +OMNIAUTH_FRANCE_CONNECT_PROFILE_MINIMUM_AGE= + +ENABLE_LETTER_OPENER=0 \ No newline at end of file diff --git a/.github/workflows/CI_CD.yml b/.github/workflows/CI_CD.yml index 08c4789..cf6cb41 100644 --- a/.github/workflows/CI_CD.yml +++ b/.github/workflows/CI_CD.yml @@ -5,9 +5,9 @@ env: CI: "true" SIMPLECOV: "true" RSPEC_FORMAT: "documentation" - RUBY_VERSION: 2.6.5 + RUBY_VERSION: 2.6.9 RAILS_ENV: test - NODE_VERSION: 16.9.1 + NODE_VERSION: 22.17.1 jobs: lint: @@ -102,7 +102,7 @@ jobs: DATABASE_PASSWORD: postgres DATABASE_HOST: host.docker.internal steps: - - uses: OpenSourcePolitics/build-and-test-images-action@master + - uses: OpenSourcePolitics/build-and-test-images-action@ppan with: registry: ${{ vars.REGISTRY_ENDPOINT }} namespace: ${{ vars.REGISTRY_NAMESPACE }} @@ -118,7 +118,7 @@ jobs: needs: [ lint, tests, system_tests, test_build ] runs-on: ubuntu-latest steps: - - uses: OpenSourcePolitics/build-and-push-images-action@master + - uses: OpenSourcePolitics/build-and-push-images-action@ppan with: registry: ${{ vars.REGISTRY_ENDPOINT }} namespace: ${{ vars.REGISTRY_NAMESPACE }} diff --git a/.node-version b/.node-version index fc2cbe5..7377d13 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -15.14.0 +22.17.1 diff --git a/.ruby-version b/.ruby-version index 57cf282..d48d370 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.5 +2.6.9 diff --git a/Dockerfile b/Dockerfile index 2a24649..8301bca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,16 @@ -FROM ruby:2.6.5 +FROM ruby:2.6.9 ENV RAILS_ENV=production ENV SECRET_KEY_BASE=dummy # Install NodeJS -RUN curl https://deb.nodesource.com/setup_lts.x | bash && \ +RUN curl https://deb.nodesource.com/setup_22.x | bash && \ apt install -y nodejs && \ apt update && \ npm install -g npm@8.19.2 && \ npm install --global yarn && \ apt install -y libicu-dev postgresql-client && \ - gem install bundler:2.2.17 + gem install bundler:2.2.24 COPY Gemfile* ./ RUN bundle config set --local without 'development test' && bundle install diff --git a/Gemfile b/Gemfile index 55bedd4..62c0502 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ gem "decidim-initiatives", git: "https://github.com/OpenSourcePolitics/decidim.g gem "decidim-cleaner", git: "https://github.com/OpenSourcePolitics/decidim-module-cleaner.git", branch: "release/0.22-stable" gem "decidim-term_customizer", git: "https://github.com/OpenSourcePolitics/decidim-module-term_customizer.git", branch: "0.dev" -gem "bootsnap" +gem "bootsnap", "1.7.5" gem "puma", ">= 4.3" gem "uglifier" @@ -22,8 +22,8 @@ gem "wkhtmltopdf-binary" gem "activerecord-session_store" -gem "omniauth_openid_connect", "0.3.1" -gem "openid_connect", "~> 1.3" +gem "faraday", "2.8.1" +gem "omniauth_openid_connect", "~> 0.8.0" gem "ruby-progressbar" gem "rubyzip", require: "zip" @@ -31,7 +31,8 @@ gem "sentry-raven" gem "dotenv-rails" gem "health_check" -gem "rails", "5.2.4.4" +gem "rack-attack", "~> 6.0" +gem "rails", "5.2.6" gem "sidekiq_alive" group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 435f86c..5a23475 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -17,7 +17,7 @@ GIT GIT remote: https://github.com/OpenSourcePolitics/decidim.git - revision: 0f733013225bc5ab27a1cb23d729fa89c9492867 + revision: 14eb1ead353e4113509dc8bb6b8df1b808c91f8a branch: alt/petition_merge specs: decidim (0.22.0.dev) @@ -228,25 +228,25 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.2.4.4) - actionpack (= 5.2.4.4) + actioncable (5.2.6) + actionpack (= 5.2.6) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4.4) - actionpack (= 5.2.4.4) - actionview (= 5.2.4.4) - activejob (= 5.2.4.4) + actionmailer (5.2.6) + actionpack (= 5.2.6) + actionview (= 5.2.6) + activejob (= 5.2.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4.4) - actionview (= 5.2.4.4) - activesupport (= 5.2.4.4) + actionpack (5.2.6) + actionview (= 5.2.6) + activesupport (= 5.2.6) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4.4) - activesupport (= 5.2.4.4) + actionview (5.2.6) + activesupport (= 5.2.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -254,14 +254,14 @@ GEM active_link_to (1.0.5) actionpack addressable - activejob (5.2.4.4) - activesupport (= 5.2.4.4) + activejob (5.2.6) + activesupport (= 5.2.6) globalid (>= 0.3.6) - activemodel (5.2.4.4) - activesupport (= 5.2.4.4) - activerecord (5.2.4.4) - activemodel (= 5.2.4.4) - activesupport (= 5.2.4.4) + activemodel (5.2.6) + activesupport (= 5.2.6) + activerecord (5.2.6) + activemodel (= 5.2.6) + activesupport (= 5.2.6) arel (>= 9.0) activerecord-session_store (2.0.0) actionpack (>= 5.2.4.1) @@ -269,41 +269,41 @@ GEM multi_json (~> 1.11, >= 1.11.2) rack (>= 2.0.8, < 3) railties (>= 5.2.4.1) - activestorage (5.2.4.4) - actionpack (= 5.2.4.4) - activerecord (= 5.2.4.4) - marcel (~> 0.3.1) - activesupport (5.2.4.4) + activestorage (5.2.6) + actionpack (= 5.2.6) + activerecord (= 5.2.6) + marcel (~> 1.0.0) + activesupport (5.2.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) acts_as_list (0.9.19) activerecord (>= 3.0) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.4) + public_suffix (>= 2.0.2, < 6.0) aes_key_wrap (1.1.0) anchored (1.1.0) arel (9.0.0) ast (2.4.2) - attr_required (1.0.1) + attr_required (1.0.2) autoprefixer-rails (8.6.5) execjs - aws-eventstream (1.1.1) - aws-partitions (1.460.0) - aws-sdk-core (3.114.0) + aws-eventstream (1.2.0) + aws-partitions (1.638.0) + aws-sdk-core (3.156.0) aws-eventstream (~> 1, >= 1.0.2) - aws-partitions (~> 1, >= 1.239.0) + aws-partitions (~> 1, >= 1.525.0) aws-sigv4 (~> 1.1) - jmespath (~> 1.0) - aws-sdk-kms (1.43.0) - aws-sdk-core (~> 3, >= 3.112.0) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.58.0) + aws-sdk-core (~> 3, >= 3.127.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.94.1) - aws-sdk-core (~> 3, >= 3.112.0) + aws-sdk-s3 (1.114.0) + aws-sdk-core (~> 3, >= 3.127.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.3) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.5.1) aws-eventstream (~> 1, >= 1.0.2) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) @@ -313,8 +313,9 @@ GEM babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) execjs (~> 2.0) + base64 (0.3.0) batch-loader (1.5.0) - bcrypt (3.1.16) + bcrypt (3.1.18) better_html (1.0.16) actionview (>= 4.0) activesupport (>= 4.0) @@ -323,15 +324,16 @@ GEM html_tokenizer (~> 0.0.6) parser (>= 2.4) smart_properties - bindata (2.4.10) + bindata (2.5.1) bindex (0.8.1) bootsnap (1.7.5) msgpack (~> 1.0) browser (2.7.1) builder (3.2.4) byebug (11.1.3) - capybara (3.35.3) + capybara (3.36.0) addressable + matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) @@ -371,7 +373,7 @@ GEM crack (0.4.5) rexml crass (1.0.6) - css_parser (1.9.0) + css_parser (1.11.0) addressable dalli (2.7.11) dalli-elasticache (0.2.0) @@ -387,18 +389,18 @@ GEM declarative-option (0.1.0) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (4.8.0) + devise (4.8.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.9.4) - devise (>= 4.7.1) + devise-i18n (1.10.2) + devise (>= 4.8.0) devise_invitable (1.7.5) actionmailer (>= 4.1.0) devise (>= 4.0.0) - diff-lcs (1.4.4) + diff-lcs (1.5.0) diffy (3.4.0) doc2text (0.4.3) nokogiri (~> 1.11.1) @@ -406,7 +408,7 @@ GEM docile (1.4.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - doorkeeper (5.5.1) + doorkeeper (5.5.4) railties (>= 5) doorkeeper-i18n (4.0.1) dotenv (2.7.6) @@ -414,6 +416,8 @@ GEM dotenv (= 2.7.6) railties (>= 3.2) e2mmap (0.1.0) + email_validator (2.2.4) + activemodel equalizer (0.0.11) erb_lint (0.0.37) activesupport @@ -428,9 +432,9 @@ GEM erubi (1.10.0) et-orbi (1.2.4) tzinfo - etherpad-lite (0.3.0) + etherpad-lite (0.3.1) rest-client (>= 1.6) - excon (0.81.0) + excon (0.82.0) execjs (2.8.1) factory_bot (4.11.1) activesupport (>= 3.0.0) @@ -439,16 +443,14 @@ GEM railties (>= 3.0.0) faker (1.9.6) i18n (>= 0.7) - faraday (1.4.1) - faraday-excon (~> 1.1) - faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.1) - multipart-post (>= 1.2, < 3) + faraday (2.8.1) + base64 + faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-excon (1.1.0) - faraday-net_http (1.0.1) - faraday-net_http_persistent (1.1.0) - ffi (1.15.0) + faraday-follow_redirects (0.3.0) + faraday (>= 1, < 3) + faraday-net_http (3.0.2) + ffi (1.15.1) file_validators (2.3.0) activemodel (>= 3.2) mime-types (>= 1.0) @@ -479,16 +481,16 @@ GEM activesupport (>= 4.1, < 6.0) railties (>= 4.1, < 6.0) tzinfo (~> 1.2, >= 1.2.2) - fugit (1.4.5) + fugit (1.5.0) et-orbi (~> 1.1, >= 1.1.8) raabro (~> 1.4) - geocoder (1.6.7) + geocoder (1.8.0) globalid (0.4.2) activesupport (>= 4.2.0) graphiql-rails (1.4.11) railties sprockets-rails - graphql (1.12.10) + graphql (1.13.13) hashdiff (1.0.1) hashie (4.1.0) health_check (3.1.0) @@ -498,15 +500,14 @@ GEM html_tokenizer (0.0.7) htmlentities (4.3.4) http-accept (1.7.0) - http-cookie (1.0.3) + http-cookie (1.0.5) domain_name (~> 0.5) - httparty (0.18.1) + httparty (0.20.0) mime-types (~> 3.0) multi_xml (>= 0.5.2) - httpclient (2.8.3) i18n (1.8.10) concurrent-ruby (~> 1.0) - i18n-tasks (0.9.34) + i18n-tasks (0.9.37) activesupport (>= 4.0.2) ast (>= 2.1.0) erubi @@ -518,49 +519,52 @@ GEM terminal-table (>= 1.5.1) icalendar (2.7.1) ice_cube (~> 0.16) - ice_cube (0.16.3) + ice_cube (0.16.4) ice_nine (0.11.2) invisible_captcha (0.13.0) rails (>= 3.2.0) ipaddress (0.8.3) jaro_winkler (1.5.4) - jmespath (1.4.0) - jquery-rails (4.4.0) + jmespath (1.6.1) + jquery-rails (4.5.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-tmpl-rails (1.1.0) rails (>= 3.1.0) - json-jwt (1.13.0) + json-jwt (1.16.7) activesupport (>= 4.2) aes_key_wrap + base64 bindata - jwt (2.2.3) - kaminari (1.2.1) + faraday (~> 2.0) + faraday-follow_redirects + jwt (2.4.1) + kaminari (1.2.2) activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.1) - kaminari-activerecord (= 1.2.1) - kaminari-core (= 1.2.1) - kaminari-actionview (1.2.1) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) actionview - kaminari-core (= 1.2.1) - kaminari-activerecord (1.2.1) + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) activerecord - kaminari-core (= 1.2.1) - kaminari-core (1.2.1) + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) kramdown (1.17.0) launchy (2.5.0) addressable (~> 2.7) - letter_opener (1.7.0) - launchy (~> 2.2) - letter_opener_web (1.4.0) + letter_opener (1.8.1) + launchy (>= 2.2, < 3) + letter_opener_web (1.4.1) actionmailer (>= 3.2) letter_opener (~> 1.0) railties (>= 3.2) listen (3.5.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - lograge (0.11.2) + lograge (0.12.0) actionpack (>= 4) activesupport (>= 4) railties (>= 4) @@ -570,8 +574,8 @@ GEM nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) + marcel (1.0.2) + matrix (0.4.2) mdl (0.5.0) kramdown (~> 1.12, >= 1.12.0) mixlib-cli (~> 1.7, >= 1.7.0) @@ -580,12 +584,9 @@ GEM mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2021.0225) - mimemagic (0.3.10) - nokogiri (~> 1) - rake mini_magick (4.11.0) mini_mime (1.1.1) - mini_portile2 (2.5.1) + mini_portile2 (2.5.3) minitest (5.14.4) mixlib-cli (1.7.0) mixlib-config (2.2.18) @@ -593,18 +594,17 @@ GEM msgpack (1.4.2) multi_json (1.15.0) multi_xml (0.6.0) - multipart-post (2.1.1) mustache (1.1.1) netrc (0.11.0) - newrelic_rpm (7.0.0) + newrelic_rpm (7.1.0) nio4r (2.5.7) nobspw (0.6.2) - nokogiri (1.11.5) + nokogiri (1.11.7) mini_portile2 (~> 2.5.0) racc (~> 1.4) - oauth (0.5.6) - oauth2 (1.4.7) - faraday (>= 0.8, < 2.0) + oauth (0.5.10) + oauth2 (1.4.9) + faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) @@ -622,7 +622,7 @@ GEM omniauth-oauth (1.2.0) oauth omniauth (>= 1.0, < 3) - omniauth-oauth2 (1.7.1) + omniauth-oauth2 (1.7.2) oauth2 (~> 1.4) omniauth (>= 1.9, < 3) omniauth-rails_csrf_protection (0.1.2) @@ -631,34 +631,36 @@ GEM omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) rack - omniauth_openid_connect (0.3.1) - addressable (~> 2.5) - omniauth (~> 1.3) - openid_connect (~> 1.1) - openid_connect (1.3.0) + omniauth_openid_connect (0.8.0) + omniauth (>= 1.9, < 3) + openid_connect (~> 2.2) + openid_connect (2.3.1) activemodel attr_required (>= 1.0.0) - json-jwt (>= 1.5.0) - rack-oauth2 (>= 1.6.1) - swd (>= 1.0.0) + email_validator + faraday (~> 2.0) + faraday-follow_redirects + json-jwt (>= 1.16) + mail + rack-oauth2 (~> 2.2) + swd (~> 2.0) tzinfo - validate_email validate_url - webfinger (>= 1.0.1) + webfinger (~> 2.0) origami (2.1.0) colorize (~> 0.7) orm_adapter (0.5.0) paper_trail (10.3.1) activerecord (>= 4.2) request_store (~> 1.1) - parallel (1.20.1) - parser (3.0.1.1) + parallel (1.22.1) + parser (3.1.2.0) ast (~> 2.4.1) - passenger (6.0.8) + passenger (6.0.15) rack rake (>= 0.8.1) pg (1.1.4) - pg_search (2.3.5) + pg_search (2.3.6) activerecord (>= 5.2) activesupport (>= 5.2) premailer (1.15.0) @@ -668,36 +670,37 @@ GEM premailer-rails (1.11.1) actionmailer (>= 3) premailer (~> 1.7, >= 1.7.9) - public_suffix (4.0.6) - puma (5.3.1) + public_suffix (5.0.1) + puma (5.3.2) nio4r (~> 2.0) raabro (1.4.0) racc (1.5.2) rack (2.2.3) - rack-attack (6.5.0) + rack-attack (6.6.1) rack (>= 1.0, < 3) rack-cors (1.1.1) rack (>= 2.0.0) - rack-oauth2 (1.19.0) + rack-oauth2 (2.2.1) activesupport attr_required - httpclient + faraday (~> 2.0) + faraday-follow_redirects json-jwt (>= 1.11.0) rack (>= 2.1.0) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.4.4) - actioncable (= 5.2.4.4) - actionmailer (= 5.2.4.4) - actionpack (= 5.2.4.4) - actionview (= 5.2.4.4) - activejob (= 5.2.4.4) - activemodel (= 5.2.4.4) - activerecord (= 5.2.4.4) - activestorage (= 5.2.4.4) - activesupport (= 5.2.4.4) + rails (5.2.6) + actioncable (= 5.2.6) + actionmailer (= 5.2.6) + actionpack (= 5.2.6) + actionview (= 5.2.6) + activejob (= 5.2.6) + activemodel (= 5.2.6) + activerecord (= 5.2.6) + activestorage (= 5.2.6) + activesupport (= 5.2.6) bundler (>= 1.3.0) - railties (= 5.2.4.4) + railties (= 5.2.6) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -711,13 +714,13 @@ GEM rails-i18n (5.1.3) i18n (>= 0.7, < 2) railties (>= 5.0, < 6) - railties (5.2.4.4) - actionpack (= 5.2.4.4) - activesupport (= 5.2.4.4) + railties (5.2.6) + actionpack (= 5.2.6) + activesupport (= 5.2.6) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) - rainbow (3.0.0) + rainbow (3.1.1) rake (13.0.3) ransack (2.1.1) actionpack (>= 5.0) @@ -734,9 +737,9 @@ GEM virtus (~> 1.0.5) wisper (>= 1.6.1) redcarpet (3.5.1) - redis (4.2.5) - regexp_parser (2.1.1) - request_store (1.5.0) + redis (4.3.1) + regexp_parser (2.5.0) + request_store (1.5.1) rack (>= 1.4) responders (3.0.1) actionpack (>= 5.0) @@ -751,9 +754,9 @@ GEM rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) rspec-mocks (~> 3.9.0) - rspec-cells (0.3.5) + rspec-cells (0.3.7) cells (>= 4.0.0, < 6.0.0) - rspec-rails (< 5.0) + rspec-rails (< 6.0) rspec-core (3.9.3) rspec-support (~> 3.9.3) rspec-expectations (3.9.4) @@ -792,8 +795,8 @@ GEM rubocop (>= 0.68.1) ruby-ole (1.2.12.2) ruby-progressbar (1.11.0) - ruby2_keywords (0.0.4) - ruby_http_client (3.5.2) + ruby2_keywords (0.0.5) + ruby_http_client (3.5.5) rubyzip (2.3.0) rufus-scheduler (3.7.0) fugit (~> 1.1, >= 1.1.6) @@ -810,7 +813,7 @@ GEM selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) - sendgrid-ruby (6.4.0) + sendgrid-ruby (6.6.2) ruby_http_client (~> 3.4) sentry-raven (3.1.2) faraday (>= 1.0) @@ -819,14 +822,14 @@ GEM connection_pool (>= 2.2.2) rack (~> 2.0) redis (>= 4.2.0) - sidekiq-scheduler (3.0.1) + sidekiq-scheduler (3.1.0) e2mmap redis (>= 3, < 5) rufus-scheduler (~> 3.2) sidekiq (>= 3) thwait tilt (>= 1.4.0) - sidekiq_alive (2.1.4) + sidekiq_alive (2.1.5) sidekiq webrick simplecov (0.18.5) @@ -835,10 +838,10 @@ GEM simplecov-cobertura (1.3.1) simplecov (~> 0.8) simplecov-html (0.12.3) - smart_properties (1.15.0) + smart_properties (1.17.0) social-share-button (1.2.4) coffee-rails - spreadsheet (1.2.9) + spreadsheet (1.3.0) ruby-ole spring (2.1.1) spring-watcher-listen (2.0.1) @@ -851,26 +854,27 @@ GEM babel-source (>= 5.8.11) babel-transpiler sprockets (>= 3.0.0) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) ssrf_filter (1.0.7) - swd (1.3.0) + swd (2.0.3) activesupport (>= 3) attr_required (>= 0.0.5) - httpclient (>= 2.4) + faraday (~> 2.0) + faraday-follow_redirects system_test_html_screenshots (0.1.2) actionpack (>= 5.2, < 6.0.a) temple (0.8.2) - terminal-table (3.0.1) + terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) thor (1.1.0) thread_safe (0.3.6) thwait (0.2.0) e2mmap tilt (2.0.10) - tomlrb (2.0.1) + tomlrb (2.0.3) truncato (0.7.11) htmlentities (~> 4.3.1) nokogiri (>= 1.7.0, <= 2.0) @@ -881,15 +885,12 @@ GEM execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.7.7) + unf_ext (0.0.8.2) unicode-display_width (1.6.1) valid_email2 (2.3.1) activemodel (>= 3.2) mail (~> 2.5) - validate_email (0.1.6) - activemodel (>= 3.0) - mail (>= 2.2.5) - validate_url (1.0.13) + validate_url (1.0.15) activemodel (>= 3.0.0) public_suffix virtus (1.0.5) @@ -906,18 +907,19 @@ GEM activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - webfinger (1.2.0) + webfinger (2.1.3) activesupport - httpclient (>= 2.4) + faraday (~> 2.0) + faraday-follow_redirects webmock (3.13.0) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) webrick (1.7.0) - websocket-driver (0.7.3) + websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - wicked (1.3.4) + wicked (1.4.0) railties (>= 3.0.7) wicked_pdf (1.4.0) activesupport @@ -933,7 +935,7 @@ PLATFORMS DEPENDENCIES activerecord-session_store aws-sdk-s3 - bootsnap + bootsnap (= 1.7.5) byebug (~> 11.0) dalli dalli-elasticache @@ -944,6 +946,7 @@ DEPENDENCIES decidim-term_customizer! dotenv-rails faker (~> 1.9) + faraday (= 2.8.1) fog-aws health_check hiredis @@ -951,11 +954,11 @@ DEPENDENCIES listen (~> 3.1) lograge newrelic_rpm - omniauth_openid_connect (= 0.3.1) - openid_connect (~> 1.3) + omniauth_openid_connect (~> 0.8.0) passenger puma (>= 4.3) - rails (= 5.2.4.4) + rack-attack (~> 6.0) + rails (= 5.2.6) redis ruby-progressbar rubyzip @@ -972,7 +975,7 @@ DEPENDENCIES wkhtmltopdf-binary RUBY VERSION - ruby 2.6.5p114 + ruby 2.6.9p207 BUNDLED WITH - 2.2.17 + 2.2.24 diff --git a/app/assets/images/FranceConnect-Bouton/01-Principal/png/franceconnect-btn-principal-hover.png b/app/assets/images/FranceConnect-Bouton/01-Principal/png/franceconnect-btn-principal-hover.png new file mode 100644 index 0000000..25da7e8 Binary files /dev/null and b/app/assets/images/FranceConnect-Bouton/01-Principal/png/franceconnect-btn-principal-hover.png differ diff --git a/app/assets/images/FranceConnect-Bouton/01-Principal/png/franceconnect-btn-principal-hover@2x.png b/app/assets/images/FranceConnect-Bouton/01-Principal/png/franceconnect-btn-principal-hover@2x.png new file mode 100644 index 0000000..6b18819 Binary files /dev/null and b/app/assets/images/FranceConnect-Bouton/01-Principal/png/franceconnect-btn-principal-hover@2x.png differ diff --git a/app/assets/images/FranceConnect-Bouton/01-Principal/png/franceconnect-btn-principal.png b/app/assets/images/FranceConnect-Bouton/01-Principal/png/franceconnect-btn-principal.png new file mode 100644 index 0000000..78b6966 Binary files /dev/null and b/app/assets/images/FranceConnect-Bouton/01-Principal/png/franceconnect-btn-principal.png differ diff --git a/app/assets/images/FranceConnect-Bouton/01-Principal/png/franceconnect-btn-principal@2x.png b/app/assets/images/FranceConnect-Bouton/01-Principal/png/franceconnect-btn-principal@2x.png new file mode 100644 index 0000000..f7b1405 Binary files /dev/null and b/app/assets/images/FranceConnect-Bouton/01-Principal/png/franceconnect-btn-principal@2x.png differ diff --git a/app/assets/images/FranceConnect-Bouton/01-Principal/svg/franceconnect-btn-principal-hover.svg b/app/assets/images/FranceConnect-Bouton/01-Principal/svg/franceconnect-btn-principal-hover.svg new file mode 100644 index 0000000..6369697 --- /dev/null +++ b/app/assets/images/FranceConnect-Bouton/01-Principal/svg/franceconnect-btn-principal-hover.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/app/assets/images/FranceConnect-Bouton/01-Principal/svg/franceconnect-btn-principal.svg b/app/assets/images/FranceConnect-Bouton/01-Principal/svg/franceconnect-btn-principal.svg new file mode 100644 index 0000000..a2f3785 --- /dev/null +++ b/app/assets/images/FranceConnect-Bouton/01-Principal/svg/franceconnect-btn-principal.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/app/assets/images/FranceConnect-Bouton/02-Alternatif/png/franceconnect-btn-alt-hover.png b/app/assets/images/FranceConnect-Bouton/02-Alternatif/png/franceconnect-btn-alt-hover.png new file mode 100644 index 0000000..358f95d Binary files /dev/null and b/app/assets/images/FranceConnect-Bouton/02-Alternatif/png/franceconnect-btn-alt-hover.png differ diff --git a/app/assets/images/FranceConnect-Bouton/02-Alternatif/png/franceconnect-btn-alt-hover@2x.png b/app/assets/images/FranceConnect-Bouton/02-Alternatif/png/franceconnect-btn-alt-hover@2x.png new file mode 100644 index 0000000..25fc632 Binary files /dev/null and b/app/assets/images/FranceConnect-Bouton/02-Alternatif/png/franceconnect-btn-alt-hover@2x.png differ diff --git a/app/assets/images/FranceConnect-Bouton/02-Alternatif/png/franceconnect-btn-alt.png b/app/assets/images/FranceConnect-Bouton/02-Alternatif/png/franceconnect-btn-alt.png new file mode 100644 index 0000000..2fd4524 Binary files /dev/null and b/app/assets/images/FranceConnect-Bouton/02-Alternatif/png/franceconnect-btn-alt.png differ diff --git a/app/assets/images/FranceConnect-Bouton/02-Alternatif/png/franceconnect-btn-alt@2x.png b/app/assets/images/FranceConnect-Bouton/02-Alternatif/png/franceconnect-btn-alt@2x.png new file mode 100644 index 0000000..125e8e0 Binary files /dev/null and b/app/assets/images/FranceConnect-Bouton/02-Alternatif/png/franceconnect-btn-alt@2x.png differ diff --git a/app/assets/images/FranceConnect-Bouton/02-Alternatif/svg/franceconnect-btn-alt-hover.svg b/app/assets/images/FranceConnect-Bouton/02-Alternatif/svg/franceconnect-btn-alt-hover.svg new file mode 100644 index 0000000..fd1e827 --- /dev/null +++ b/app/assets/images/FranceConnect-Bouton/02-Alternatif/svg/franceconnect-btn-alt-hover.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/app/assets/images/FranceConnect-Bouton/02-Alternatif/svg/franceconnect-btn-alt.svg b/app/assets/images/FranceConnect-Bouton/02-Alternatif/svg/franceconnect-btn-alt.svg new file mode 100644 index 0000000..a08a877 --- /dev/null +++ b/app/assets/images/FranceConnect-Bouton/02-Alternatif/svg/franceconnect-btn-alt.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/app/assets/images/FranceConnect-Bouton/03-Desactive/png/franceconnect-btn-desactive.png b/app/assets/images/FranceConnect-Bouton/03-Desactive/png/franceconnect-btn-desactive.png new file mode 100644 index 0000000..6ea0412 Binary files /dev/null and b/app/assets/images/FranceConnect-Bouton/03-Desactive/png/franceconnect-btn-desactive.png differ diff --git a/app/assets/images/FranceConnect-Bouton/03-Desactive/png/franceconnect-btn-desactive@2x.png b/app/assets/images/FranceConnect-Bouton/03-Desactive/png/franceconnect-btn-desactive@2x.png new file mode 100644 index 0000000..a1bea57 Binary files /dev/null and b/app/assets/images/FranceConnect-Bouton/03-Desactive/png/franceconnect-btn-desactive@2x.png differ diff --git a/app/assets/images/FranceConnect-Bouton/03-Desactive/svg/franceconnect-btn-desactive.svg b/app/assets/images/FranceConnect-Bouton/03-Desactive/svg/franceconnect-btn-desactive.svg new file mode 100644 index 0000000..57b3cfa --- /dev/null +++ b/app/assets/images/FranceConnect-Bouton/03-Desactive/svg/franceconnect-btn-desactive.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/app/assets/stylesheets/decidim.scss b/app/assets/stylesheets/decidim.scss index 6aa8ffd..4e40f55 100644 --- a/app/assets/stylesheets/decidim.scss +++ b/app/assets/stylesheets/decidim.scss @@ -223,6 +223,9 @@ $navbar-background: darken( $title-bar-background, 10%); } } +// ------------------------------------------------------------------ +// SIGNUP / SIGNIN / PROFILE + .button--social { margin: 0 auto; white-space: nowrap; @@ -263,40 +266,6 @@ $navbar-background: darken( $title-bar-background, 10%); .button--label b { white-space: nowrap; } - - // .sessions & { - // &.button--social { - // margin: 0 auto; - // - // height: 2.8em; - // margin-bottom: 1rem; - // - // .button--social__icon { - // display: block; - // float: left; - // padding: .35em .5em; - // height: 2.5em; - // - // .icon { - // width: 2em; - // height: 2em; - // } - // } - // - // .button--label { - // display: block; - // padding-top: 0.6em; - // text-align: center; - // line-height: 1.5rem; - // - // b { - // font-size: 1.2rem; - // } - // } - // } - // } - - } .button--social--custom { @@ -305,9 +274,22 @@ $navbar-background: darken( $title-bar-background, 10%); padding: 0; background-color: transparent; max-width: 282px; + margin-bottom: 12px; + + img.button--is-hover { + display: none; + } &:hover, &:focus { background-color: transparent; + filter: none; + + img.button--has-hover { + display: none; + } + img.button--is-hover { + display: inline-block; + } } } @@ -522,3 +504,4 @@ main.anonymous { display: block; margin: 0 auto; } + diff --git a/app/views/decidim/devise/shared/_omniauth_buttons.html.erb b/app/views/decidim/devise/shared/_omniauth_buttons.html.erb index 0c94137..4454cc5 100644 --- a/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +++ b/app/views/decidim/devise/shared/_omniauth_buttons.html.erb @@ -13,7 +13,12 @@
<% if provider[:button_path].present? %> <%= link_to decidim.send("user_#{name}_omniauth_authorize_path"), class: "button button--social--custom", method: :post do %> - <%= image_tag provider[:button_path], alt: t("devise.shared.links.sign_in_with_provider", provider: normalize_provider_name(name).titleize) %> + <% if provider[:button_hover_path].present? %> + <%= image_tag provider[:button_path], class: "button--has-hover", alt: t("devise.shared.links.sign_in_with_provider", provider: normalize_provider_name(name).titleize) %> + <%= image_tag provider[:button_hover_path], class: "button--is-hover", alt: t("devise.shared.links.sign_in_with_provider", provider: normalize_provider_name(name).titleize) %> + <% else %> + <%= image_tag provider[:button_path], alt: t("devise.shared.links.sign_in_with_provider", provider: normalize_provider_name(name).titleize) %> + <% end %> <% end %> <% if I18n.exists?("decidim.omniauth.france_connect.external.link") %> <%= link_to t("link", scope: "decidim.omniauth.france_connect.external"), class: "primary", target: "_blank" do %> diff --git a/config/environments/production.rb b/config/environments/production.rb index 5744702..e02073d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -85,16 +85,22 @@ # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new - config.action_mailer.smtp_settings = { - address: Rails.application.secrets.smtp_address, - port: Rails.application.secrets.smtp_port, - authentication: Rails.application.secrets.smtp_authentication, - user_name: Rails.application.secrets.smtp_username, - password: Rails.application.secrets.smtp_password, - domain: Rails.application.secrets.smtp_domain, - enable_starttls_auto: Rails.application.secrets.smtp_starttls_auto, - openssl_verify_mode: "none" - } + if ENV.fetch("ENABLE_LETTER_OPENER", "0") == "1" + config.action_mailer.delivery_method = :letter_opener_web + config.action_mailer.default_url_options = { port: 3000 } + else + config.action_mailer.delivery_method = :smtp + config.action_mailer.smtp_settings = { + address: Rails.application.secrets.smtp_address, + port: Rails.application.secrets.smtp_port, + authentication: Rails.application.secrets.smtp_authentication, + user_name: Rails.application.secrets.smtp_username, + password: Rails.application.secrets.smtp_password, + domain: Rails.application.secrets.smtp_domain, + enable_starttls_auto: Rails.application.secrets.smtp_starttls_auto, + openssl_verify_mode: "none" + } + end config.action_mailer.default_options = { "X-Mailjet-TrackOpen" => 0, diff --git a/config/initializers/extends.rb b/config/initializers/extends.rb index ddc9dcd..9491b0b 100644 --- a/config/initializers/extends.rb +++ b/config/initializers/extends.rb @@ -10,3 +10,5 @@ require "extends/destroy_account_extend" require "extends/create_omniauth_registration_extend" require "extends/update_account_extend" +require "extends/openid_connect/access_token_extends" +require "extends/graphql_schema_get_field_extend" diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index ee017bb..8335a63 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -3,6 +3,8 @@ require "omniauth/strategies/france_connect_uid" require "omniauth/strategies/france_connect_profile" +OmniAuth.config.logger = Rails.logger + Rails.application.config.middleware.use OmniAuth::Builder do OmniAuth.config.logger = Rails.logger omniauth_config = Rails.application.secrets.dig(:omniauth) @@ -11,10 +13,10 @@ provider( :france_connect_uid, setup: setup_provider_proc(:france_connect_uid, - site: :site, + issuer: :site, client_id: :client_id, client_secret: :client_secret, - end_session_endpoint: :end_session_endpoint, + post_logout_redirect_uri: :post_logout_redirect_uri, icon_path: :icon_path, button_path: :button_path, provider_name: :provider_name, @@ -26,10 +28,10 @@ provider( :france_connect_profile, setup: setup_provider_proc(:france_connect_profile, - site: :site, + issuer: :site, client_id: :client_id, client_secret: :client_secret, - end_session_endpoint: :end_session_endpoint, + post_logout_redirect_uri: :post_logout_redirect_uri, icon_path: :icon_path, button_path: :button_path, provider_name: :provider_name, @@ -37,56 +39,3 @@ ) end end - -# if Rails.application.secrets.dig(:omniauth, :france_connect_uid).present? && Rails.application.secrets.dig(:omniauth, :france_connect_uid, :enabled) -# ::Devise.setup do |config| -# config.omniauth :france_connect_uid, { -# name: "france_connect_uid", -# issuer: "https://" + Rails.application.secrets.dig(:omniauth, :france_connect_uid, :host), -# scope: [:openid], -# client_signing_alg: :HS256, -# client_auth_method: :body, -# acr_values: "eidas1" , -# client_options: { -# host: Rails.application.secrets.dig(:omniauth, :france_connect_uid, :host), -# authorization_endpoint: '/api/v1/authorize', -# token_endpoint: '/api/v1/token', -# userinfo_endpoint: '/api/v1/userinfo', -# jwks_uri: '/api/v1/jwk', -# end_session_endpoint: '/api/v1/logout', -# identifier: Rails.application.secrets.dig(:omniauth, :france_connect_uid, :identifier), -# secret: Rails.application.secrets.dig(:omniauth, :france_connect_uid, :secret), -# redirect_uri: Rails.application.secrets.dig(:omniauth, :france_connect_uid, :redirect_uri) -# } -# } -# end -# -# Decidim::User.omniauth_providers << :france_connect_uid -# end -# -# if Rails.application.secrets.dig(:omniauth, :france_connect_profile).present? && Rails.application.secrets.dig(:omniauth, :france_connect_profile, :enabled) -# ::Devise.setup do |config| -# config.omniauth :france_connect_profile, { -# name: "france_connect_profile", -# issuer: "https://" + Rails.application.secrets.dig(:omniauth, :france_connect_profile, :host), -# # scope: [:openid, :email, :given_name, :family_name, :preferred_username, :birthdate], -# scope: [:openid, :email, :given_name, :family_name, :birthdate], -# client_signing_alg: :HS256, -# client_auth_method: :body, -# acr_values: "eidas1" , -# client_options: { -# host: Rails.application.secrets.dig(:omniauth, :france_connect_profile, :host), -# authorization_endpoint: '/api/v1/authorize', -# token_endpoint: '/api/v1/token', -# userinfo_endpoint: '/api/v1/userinfo', -# jwks_uri: '/api/v1/jwk', -# end_session_endpoint: '/api/v1/logout', -# identifier: Rails.application.secrets.dig(:omniauth, :france_connect_profile, :identifier), -# secret: Rails.application.secrets.dig(:omniauth, :france_connect_profile, :secret), -# redirect_uri: Rails.application.secrets.dig(:omniauth, :france_connect_profile, :redirect_uri) -# } -# } -# end -# -# Decidim::User.omniauth_providers << :france_connect_profile -# end diff --git a/config/locales/en.yml b/config/locales/en.yml index 7abfd01..a3b3af4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -283,19 +283,23 @@ en: organizations: omniauth_settings: france_connect_profile: + button_hover_path: Chemin de l'image du bouton de survol button_path: Chemin de l'image du bouton client_id: ID client client_secret: Clé secrète end_session_endpoint: Endpoint de déconnexion minimum_age: Age minimum + post_logout_redirect_uri: Endpoint de retour de déconnexion (Decidim) provider_name: Nom du service site: URL principale du service france_connect_uid: + button_hover_path: Chemin de l'image du bouton de survol button_path: Chemin de l'image du bouton client_id: ID client client_secret: Clé secrète end_session_endpoint: Endpoint de déconnexion minimum_age: Age minimum + post_logout_redirect_uri: Endpoint de retour de déconnexion (Decidim) provider_name: Nom du service site: URL principale du service verifications: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 9cfcd16..0a46987 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -230,10 +230,10 @@ fr: link: https://franceconnect.gouv.fr/ text: Qu'est-ce-que FranceConnect ? france_connect_profile: - explanation: ' Pour déposer une pétition
L''auteur d''une pétition ne peut être anonyme.

Toutefois, le Sénat ne récupère, via l''authentification FranceConnect, que les informations suivantes :
nom, prénom(s), date de naissance, adresse électronique et identifiant technique.
Les noms et prénoms des auteurs de pétition sont publiés avec la pétition.
Les autres éléments ne sont pas rendus publics.

' + explanation:

Pour déposer une pétition

FranceConnect est la solution proposée par l'État pour sécuriser et simplifier la connexion à vos services en ligne.

france_connect_uid: anonymous_user: Authentifié(e) avec
FranceConnect - explanation: "Pour signer une pétition
La connexion via FranceConnect permet de conserver votre anonymat (aucune donnée personnelle n'est récupérée), tout en garantissant qu'une pétition n'est signée qu'une seule fois par une même personne physique." + explanation:

Pour signer une pétition

FranceConnect est la solution proposée par l'État pour sécuriser et simplifier la connexion à vos services en ligne.

pages: index: title: Pages d'aide @@ -276,19 +276,23 @@ fr: organizations: omniauth_settings: france_connect_profile: + button_hover_path: Chemin de l'image du bouton de survol button_path: Chemin de l'image du bouton client_id: ID client client_secret: Clé secrète - end_session_endpoint: Endpoint de déconnexion + end_session_endpoint: Endpoint de retour de déconnexion (Decidim) minimum_age: Age minimum + post_logout_redirect_uri: Endpoint de retour de déconnexion (Decidim) provider_name: Nom du service site: URL principale du service france_connect_uid: + button_hover_path: Chemin de l'image du bouton de survol button_path: Chemin de l'image du bouton client_id: ID client client_secret: Clé secrète - end_session_endpoint: Endpoint de déconnexion + end_session_endpoint: Endpoint de retour de déconnexion (Decidim) minimum_age: Age minimum + post_logout_redirect_uri: Endpoint de retour de déconnexion (Decidim) provider_name: Nom du service site: URL principale du service verifications: diff --git a/config/routes.rb b/config/routes.rb index ce4681c..e2470cd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,7 @@ require "sidekiq-scheduler/web" Rails.application.routes.draw do - mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? + mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? || ENV.fetch("ENABLE_LETTER_OPENER", "0") == "1" authenticate :admin do mount Sidekiq::Web => "/sidekiq" diff --git a/config/secrets.yml b/config/secrets.yml index 887e2a7..9d7f646 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -26,27 +26,28 @@ default: &default bucket_name: <%= ENV["SCALEWAY_BUCKET_NAME"] %> omniauth: france_connect_uid: - enabled: true - icon_path: "france-connect-logo.svg" - button_path: "FCboutons-10@2x.png" - provider_name: "FranceConnect \"Signataire\"" - site: <%= ENV["FRANCE_CONNECT_UID_SITE"] %> - client_id: <%= ENV["FRANCE_CONNECT_UID_CLIENT_ID"] %> - client_secret: <%= ENV["FRANCE_CONNECT_UID_CLIENT_SECRET"] %> + enabled: <%= ENV["OMNIAUTH_FRANCE_CONNECT_UID_ENABLED"]&.to_i || 0 %> + icon_path: <%= ENV["OMNIAUTH_FRANCE_CONNECT_UID_ICON_PATH"] %> + button_path: <%= ENV["OMNIAUTH_FRANCE_CONNECT_UID_BUTTON_PATH"] %> + button_hover_path: <%= ENV["OMNIAUTH_FRANCE_CONNECT_UID_BUTTON_HOVER_PATH"] %> + provider_name: <%= ENV["OMNIAUTH_FRANCE_CONNECT_UID_PROVIDER_NAME"] %> + site: <%= ENV["OMNIAUTH_FRANCE_CONNECT_UID_SITE"] %> + client_id: <%= ENV["OMNIAUTH_FRANCE_CONNECT_UID_CLIENT_ID"] %> + client_secret: <%= ENV["OMNIAUTH_FRANCE_CONNECT_UID_CLIENT_SECRET"] %> end_session_endpoint: <%= ENV["OMNIAUTH_FRANCE_CONNECT_UID_END_SESSION_ENDPOINT"] %> + post_logout_redirect_uri: <%= ENV["OMNIAUTH_FRANCE_CONNECT_UID_POST_LOGOUT_REDIRECT_URI"] %> minimum_age: <%= ENV["OMNIAUTH_FRANCE_CONNECT_UID_MINIMUM_AGE"] %> - # redirect_uri: "https://decidim.local.osp.cat/users/auth/france_connect_uid/callback" france_connect_profile: - enabled: true - icon_path: "france-connect-logo.svg" - button_path: "FCboutons-10@2x.png" - provider_name: "FranceConnect \"Auteur\"" - site: <%= ENV["FRANCE_CONNECT_PROFILE_SITE"] %> - client_id: <%= ENV["FRANCE_CONNECT_PROFILE_CLIENT_ID"] %> - client_secret: <%= ENV["FRANCE_CONNECT_PROFILE_CLIENT_SECRET"] %> - end_session_endpoint: <%= ENV["OMNIAUTH_FRANCE_CONNECT_PROFILE_END_SESSION_ENDPOINT"] %> + enabled: <%= ENV["OMNIAUTH_FRANCE_CONNECT_PROFILE_ENABLED"]&.to_i || 0 %> + icon_path: <%= ENV["OMNIAUTH_FRANCE_CONNECT_PROFILE_ICON_PATH"] %> + button_path: <%= ENV["OMNIAUTH_FRANCE_CONNECT_PROFILE_BUTTON_PATH"] %> + button_hover_path: <%= ENV["OMNIAUTH_FRANCE_CONNECT_PROFILE_BUTTON_HOVER_PATH"] %> + provider_name: <%= ENV["OMNIAUTH_FRANCE_CONNECT_PROFILE_PROVIDER_NAME"] %> + site: <%= ENV["OMNIAUTH_FRANCE_CONNECT_PROFILE_SITE"] %> + client_id: <%= ENV["OMNIAUTH_FRANCE_CONNECT_PROFILE_CLIENT_ID"] %> + client_secret: <%= ENV["OMNIAUTH_FRANCE_CONNECT_PROFILE_CLIENT_SECRET"] %> + post_logout_redirect_uri: <%= ENV["OMNIAUTH_FRANCE_CONNECT_PROFILE_POST_LOGOUT_REDIRECT_URI"] %> minimum_age: <%= ENV["OMNIAUTH_FRANCE_CONNECT_PROFILE_MINIMUM_AGE"] %> - # redirect_uri: "https://decidim.local.osp.cat/users/auth/france_connect_profile/callback" geocoder: here_app_id: <%= ENV["HERE_APP_ID"] %> here_app_code: <%= ENV["HERE_APP_CODE"] %> diff --git a/k8s/decidim/staging/ingress.yml b/k8s/decidim/staging/ingress.yml deleted file mode 100644 index 8a6e5d9..0000000 --- a/k8s/decidim/staging/ingress.yml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: decidim-sen-ingress - annotations: - kubernetes.io/ingress.class: "nginx" - kubernetes.io/tls-acme: "true" - cert-manager.io/issuer: letsencrypt-prod -spec: - rules: - - host: pps-int.opensourcepolitics.net - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: decidim-sen-svc - port: - number: 80 - tls: - - hosts: - - pps-int.opensourcepolitics.net - secretName: decidim-sen-ingress-secret-2 diff --git a/lib/extends/graphql_schema_get_field_extend.rb b/lib/extends/graphql_schema_get_field_extend.rb new file mode 100644 index 0000000..e19fe30 --- /dev/null +++ b/lib/extends/graphql_schema_get_field_extend.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +if GraphQL::Schema.instance_method(:get_field).arity == 2 + module GraphqlSchemaGetFieldExtend + def get_field(parent_type, field_name, _context = GraphQL::Query::NullContext) + super(parent_type, field_name) + end + end + + GraphQL::Schema.prepend(GraphqlSchemaGetFieldExtend) +end diff --git a/lib/extends/openid_connect/access_token_extends.rb b/lib/extends/openid_connect/access_token_extends.rb new file mode 100644 index 0000000..3f92709 --- /dev/null +++ b/lib/extends/openid_connect/access_token_extends.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +module AccessTokenExtends + extend ActiveSupport::Concern + + included do + def userinfo!(params = {}) + response = resource_request do + get client.userinfo_uri, params + end + + if response.is_a?(Hash) + ::OpenIDConnect::ResponseObject::UserInfo.new response.with_indifferent_access + else + response + end + end + + private + + def resource_request + res = yield + case res.status + when 200 + res.body + when 400 + raise BadRequest.new("API Access Failed", res) + when 401 + raise Unauthorized.new("Access Token Invalid or Expired", res) + when 403 + raise Forbidden.new("Insufficient Scope", res) + else + raise HttpError.new(res.status, "Unknown HttpError", res) + end + end + end +end + +OpenIDConnect::AccessToken.class_eval do + include(AccessTokenExtends) +end diff --git a/lib/omniauth/strategies/france_connect.rb b/lib/omniauth/strategies/france_connect.rb index fb03a05..6c551f8 100644 --- a/lib/omniauth/strategies/france_connect.rb +++ b/lib/omniauth/strategies/france_connect.rb @@ -11,11 +11,14 @@ class FranceConnect < OmniAuth::Strategies::OpenIDConnect option :site option :client_id option :client_secret - option :end_session_endpoint - - option :scope, [:openid, :email, :preferred_username] - option :client_signing_alg, :HS256 - option :client_auth_method, :body + # option :end_session_endpoint + + option :scope, %w(openid email preferred_username) + option :client_signing_alg, :ES256 + option :discovery, true + option :response_type, "code" + option :client_auth_method, "basic" + option :uid_field, "sub" option :acr_values, "eidas1" info do @@ -32,10 +35,6 @@ def find_name user_info.preferred_username.presence || user_info.family_name end - def authorize_uri - super + (options.acr_values.present? ? "&acr_values=#{options.acr_values}" : "") - end - def auth_hash hash = super hash.logout = end_session_uri @@ -43,40 +42,50 @@ def auth_hash end def end_session_uri - return if client_options.end_session_endpoint.blank? + return unless end_session_endpoint_is_valid? - end_session_uri = URI(options.issuer + client_options.end_session_endpoint) + end_session_uri = URI(client_options.end_session_endpoint) end_session_uri.query = URI.encode_www_form( id_token_hint: credentials[:id_token], - state: session_state, - post_logout_redirect_uri: "#{full_host}/users/auth/#{options.name}/logout" + state: new_state, + post_logout_redirect_uri: options.post_logout_redirect_uri ) end_session_uri.to_s end - private + def user_info + return @user_info if @user_info + + if access_token.id_token + decoded = decode_id_token(access_token.id_token).raw_attributes + + response = access_token.userinfo! + response = decode_id_token(response) if response.is_a?(String) + + log :debug, "Userinfo response: #{response.raw_attributes.to_h}" - def issuer - options.site + @user_info = ::OpenIDConnect::ResponseObject::UserInfo.new response.raw_attributes.merge(decoded).deep_symbolize_keys + else + @user_info = access_token.userinfo! + end end + private + def client_options - site_url = URI(options.site) + site_url = URI(options.issuer) - client_options = { + options.client_options.merge( host: site_url.host, port: site_url.port, identifier: options.client_id, secret: options.client_secret, - authorization_endpoint: "/api/v1/authorize", - token_endpoint: "/api/v1/token", - userinfo_endpoint: "/api/v1/userinfo", - jwks_uri: "/api/v1/jwk" - } - - client_options[:end_session_endpoint] = options.end_session_endpoint if options.end_session_endpoint.present? - - options.client_options.merge client_options + authorization_endpoint: "/api/v2/authorize", + token_endpoint: "/api/v2/token", + userinfo_endpoint: "/api/v2/userinfo", + jwks_uri: "/api/v2/jwks", + end_session_endpoint: "#{options.issuer}/session/end" + ) end def redirect_uri diff --git a/lib/omniauth/strategies/france_connect_profile.rb b/lib/omniauth/strategies/france_connect_profile.rb index 814c921..83c5aa1 100644 --- a/lib/omniauth/strategies/france_connect_profile.rb +++ b/lib/omniauth/strategies/france_connect_profile.rb @@ -6,7 +6,7 @@ module OmniAuth module Strategies class FranceConnectProfile < OmniAuth::Strategies::FranceConnect option :name, :france_connect_profile - option :scope, [:email, :openid, :birthdate, :given_name, :family_name] + option :scope, %w(openid email given_name family_name birthdate) info do { diff --git a/lib/omniauth/strategies/france_connect_uid.rb b/lib/omniauth/strategies/france_connect_uid.rb index 8948331..6d41274 100644 --- a/lib/omniauth/strategies/france_connect_uid.rb +++ b/lib/omniauth/strategies/france_connect_uid.rb @@ -7,7 +7,7 @@ module OmniAuth module Strategies class FranceConnectUid < OmniAuth::Strategies::FranceConnect option :name, :france_connect_uid - option :scope, [:openid] + option :scope, %w(openid) info do {