From 869a92a77738c62040bdf56dbf1de68d00a937a1 Mon Sep 17 00:00:00 2001 From: Ali Naqvi Date: Tue, 18 Jul 2023 22:44:57 +0800 Subject: [PATCH 1/3] feat: PP-51 default callback URI for each domain --- app/models/authority.rb | 4 ++++ docker-compose.yml | 3 --- lib/omniauth/strategies/generic_oauth.rb | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/authority.rb b/app/models/authority.rb index de2a58f..781bfa0 100644 --- a/app/models/authority.rb +++ b/app/models/authority.rb @@ -44,4 +44,8 @@ def get_storage config.residencies[0] end end + + def get_callback_uri + internals["default_callback_uri"] + end end diff --git a/docker-compose.yml b/docker-compose.yml index ef26386..7f785c1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,9 +20,6 @@ services: POSTGRES_USER: postgres POSTGRES_PASSWORD: password POSTGRES_DB: place_development - healthcheck: - test: /usr/bin/pg_isready - interval: 5s ports: - 5432:5432 diff --git a/lib/omniauth/strategies/generic_oauth.rb b/lib/omniauth/strategies/generic_oauth.rb index 4404727..6757a71 100644 --- a/lib/omniauth/strategies/generic_oauth.rb +++ b/lib/omniauth/strategies/generic_oauth.rb @@ -45,7 +45,7 @@ def request_phase end def callback_phase - authid = request.params["id"] + authid = request.params["id"] || (Authority.find_by_domain(request.host).get_callback_uri || OauthStrat.first.try(:id)) # Set out details once again if authid.nil? From fbc6592ad50d08c643048d10fe6167d83236e101 Mon Sep 17 00:00:00 2001 From: Ali Naqvi Date: Wed, 19 Jul 2023 12:53:19 +0800 Subject: [PATCH 2/3] Update lib/omniauth/strategies/generic_oauth.rb Co-authored-by: Stephen von Takach --- lib/omniauth/strategies/generic_oauth.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/omniauth/strategies/generic_oauth.rb b/lib/omniauth/strategies/generic_oauth.rb index 6757a71..b6e740d 100644 --- a/lib/omniauth/strategies/generic_oauth.rb +++ b/lib/omniauth/strategies/generic_oauth.rb @@ -45,7 +45,8 @@ def request_phase end def callback_phase - authid = request.params["id"] || (Authority.find_by_domain(request.host).get_callback_uri || OauthStrat.first.try(:id)) + authority = Authority.find_by_domain(request.host) + authid = request.params["id"] || (authority.get_callback_uri || OauthStrat.where(authority_id: authority.id).order(:id).first.try(:id)) # Set out details once again if authid.nil? From d982d0fe3a7c54420eacf58b2537b6d91a07fb45 Mon Sep 17 00:00:00 2001 From: Ali Naqvi Date: Wed, 19 Jul 2023 12:56:33 +0800 Subject: [PATCH 3/3] revert google-protobuf version to 3.21.12 --- Gemfile.lock | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9654986..35e5a8d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -183,8 +183,7 @@ GEM google-apis-core (>= 0.11.0, < 2.a) google-cloud-env (1.6.0) faraday (>= 0.17.3, < 3.0) - google-protobuf (3.23.4-aarch64-linux) - google-protobuf (3.23.4-x86_64-linux) + google-protobuf (3.21.12) googleapis-common-protos-types (1.6.0) google-protobuf (~> 3.14) googleauth (1.6.0)