Account: derive Auth logout urls from existing envs

pull/7337/head
Viktor Baranov 2 years ago
parent 822c310579
commit e12c4fc83f
  1. 2
      .github/workflows/config.yml
  2. 1
      CHANGELOG.md
  3. 4
      apps/block_scout_web/config/runtime/test.exs
  4. 4
      apps/block_scout_web/lib/block_scout_web/views/layout_view.ex
  5. 3
      apps/explorer/lib/explorer/account/notify.ex
  6. 3
      apps/explorer/test/explorer/account/notify/notify_test.exs
  7. 4
      config/runtime.exs
  8. 8
      deploy/testing/eth-goerli/secrets.yaml
  9. 2
      docker-compose/envs/common-blockscout.env
  10. 6
      docker/Makefile

@ -13,8 +13,6 @@ env:
OTP_VERSION: '25.2.1' OTP_VERSION: '25.2.1'
ELIXIR_VERSION: '1.14.3' ELIXIR_VERSION: '1.14.3'
ACCOUNT_AUTH0_DOMAIN: 'blockscoutcom.us.auth0.com' ACCOUNT_AUTH0_DOMAIN: 'blockscoutcom.us.auth0.com'
ACCOUNT_AUTH0_LOGOUT_URL: 'https://blockscoutcom.us.auth0.com/v2/logout'
ACCOUNT_AUTH0_LOGOUT_RETURN_URL: 'https://blockscout.com/auth/logout'
jobs: jobs:
build-and-cache: build-and-cache:

@ -22,6 +22,7 @@
### Chore ### Chore
- [#7337](https://github.com/blockscout/blockscout/pull/7337) - Account: derive Auth0 logout urls from existing envs
- [#7332](https://github.com/blockscout/blockscout/pull/7332) - Add volume for Postgres Docker containers DB - [#7332](https://github.com/blockscout/blockscout/pull/7332) - Add volume for Postgres Docker containers DB
- [#7328](https://github.com/blockscout/blockscout/pull/7328) - Update Docker image tag latest with release only - [#7328](https://github.com/blockscout/blockscout/pull/7328) - Update Docker image tag latest with release only
- [#7312](https://github.com/blockscout/blockscout/pull/7312) - Add configs for Uniswap v3 transaction actions to index them on Base Goerli - [#7312](https://github.com/blockscout/blockscout/pull/7312) - Add configs for Uniswap v3 transaction actions to index them on Base Goerli

@ -9,9 +9,7 @@ config :ueberauth, Ueberauth.Strategy.Auth0.OAuth,
client_id: "clien_id", client_id: "clien_id",
client_secret: "secrets" client_secret: "secrets"
config :ueberauth, Ueberauth, config :ueberauth, Ueberauth, logout_url: "example.com/logout"
logout_url: "example.com/logout",
logout_return_to_url: "example.com/return"
variant = Variant.get() variant = Variant.get()

@ -5,6 +5,8 @@ defmodule BlockScoutWeb.LayoutView do
alias Plug.Conn alias Plug.Conn
alias Poison.Parser alias Poison.Parser
import BlockScoutWeb.APIDocsView, only: [blockscout_url: 1]
@default_other_networks [ @default_other_networks [
%{ %{
title: "POA", title: "POA",
@ -275,7 +277,7 @@ defmodule BlockScoutWeb.LayoutView do
def sign_out_link do def sign_out_link do
client_id = Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:client_id] client_id = Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:client_id]
return_to = Application.get_env(:ueberauth, Ueberauth)[:logout_return_to_url] return_to = blockscout_url(true) <> "/auth/logout"
logout_url = Application.get_env(:ueberauth, Ueberauth)[:logout_url] logout_url = Application.get_env(:ueberauth, Ueberauth)[:logout_url]
if client_id && return_to && logout_url do if client_id && return_to && logout_url do

@ -31,8 +31,7 @@ defmodule Explorer.Account.Notify do
defp check_auth0 do defp check_auth0 do
(Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:client_id] && (Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:client_id] &&
Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:client_secret] && Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:client_secret] &&
Application.get_env(:ueberauth, Ueberauth)[:logout_return_to_url] && Application.get_env(:ueberauth, Ueberauth.Strategy.Auth0.OAuth)[:domain]) ||
Application.get_env(:ueberauth, Ueberauth)[:logout_url]) ||
raise "Auth0 not configured" raise "Auth0 not configured"
end end

@ -32,8 +32,7 @@ defmodule Explorer.Account.Notify.NotifyTest do
[callback_url: "callback.url"] [callback_url: "callback.url"]
} }
], ],
logout_url: "logout.url", logout_url: "logout.url"
logout_return_to_url: "return.url"
) )
end end

@ -134,9 +134,7 @@ config :ueberauth, Ueberauth.Strategy.Auth0.OAuth,
client_secret: System.get_env("ACCOUNT_AUTH0_CLIENT_SECRET") client_secret: System.get_env("ACCOUNT_AUTH0_CLIENT_SECRET")
# Configures Ueberauth local settings # Configures Ueberauth local settings
config :ueberauth, Ueberauth, config :ueberauth, Ueberauth, logout_url: "https://#{System.get_env("ACCOUNT_AUTH0_DOMAIN")}/v2/logout"
logout_url: System.get_env("ACCOUNT_AUTH0_LOGOUT_URL"),
logout_return_to_url: System.get_env("ACCOUNT_AUTH0_LOGOUT_RETURN_URL")
######################## ########################
### Ethereum JSONRPC ### ### Ethereum JSONRPC ###

@ -39,10 +39,6 @@ blockscout:
_default: ENC[AES256_GCM,data:+amaFFZYsjSK5CUmJuoDioStwPO/VM1NfPwVil5wLkR2sgBKUnLOd04dn9PYdvFXQ87f0OwH13NwSppKPlx3PA==,iv:fWMO6a7xtq4/OBMIo6rIHZMpuoNPbsYKiEu7lfs10XY=,tag:YXsYNKkbwT1C6tYRpni/rA==,type:str] _default: ENC[AES256_GCM,data:+amaFFZYsjSK5CUmJuoDioStwPO/VM1NfPwVil5wLkR2sgBKUnLOd04dn9PYdvFXQ87f0OwH13NwSppKPlx3PA==,iv:fWMO6a7xtq4/OBMIo6rIHZMpuoNPbsYKiEu7lfs10XY=,tag:YXsYNKkbwT1C6tYRpni/rA==,type:str]
ACCOUNT_AUTH0_CALLBACK_URL: ACCOUNT_AUTH0_CALLBACK_URL:
_default: ENC[AES256_GCM,data:6UEYDhIjZmZWa9diJwkWPzmCKRBzl+91eEOIH1uNR3qkUqhtwpF3k1o9qu54Wadw6q6Hx7ApNxiU6ZbefAjgZLY1Lzt+ZnkxOg==,iv:GXtRbFGtdK+Mp+EMXf1dINDQMIWBDNzVTFE4+Nbv9FU=,tag:215mfh63CqLl3BzRciUeig==,type:str] _default: ENC[AES256_GCM,data:6UEYDhIjZmZWa9diJwkWPzmCKRBzl+91eEOIH1uNR3qkUqhtwpF3k1o9qu54Wadw6q6Hx7ApNxiU6ZbefAjgZLY1Lzt+ZnkxOg==,iv:GXtRbFGtdK+Mp+EMXf1dINDQMIWBDNzVTFE4+Nbv9FU=,tag:215mfh63CqLl3BzRciUeig==,type:str]
ACCOUNT_AUTH0_LOGOUT_RETURN_URL:
_default: ENC[AES256_GCM,data:S0kY/XoCRJ3bYPSyuI20rY1eZtunLGjOH8+x/ggEl4+kyPKD348h4qGKVRQunbYrLcSOvJ6d7ZLmfkCdBaHTZs4=,iv:dIV/RrRjOohAe9vfbGtQT8QBVtW5gxjN3uNc1A5/spg=,tag:FYpWmrp8+TIQ4CYrYZaSUA==,type:str]
ACCOUNT_AUTH0_LOGOUT_URL:
_default: ENC[AES256_GCM,data:t4BNHWNDN6KqYdcQ7Dwod7gY7EEc0FqANm5qmosCXsyxtKAtHI4alK1/W7vFzCWo,iv:UNnPIGbs+GowAKdVK1jDjVaAlUv8RpINBOcqnhPIR1Q=,tag:dAnU1v1+EtXK/e9qgv3A4Q==,type:str]
ACCOUNT_SENDGRID_API_KEY: ACCOUNT_SENDGRID_API_KEY:
_default: ENC[AES256_GCM,data:wTkE2ISxbX2gpObQibxl4wH7FrKtZ2eflbVaVUsImnO6kP2XRDVaKXwqaoKkzE8hztWYOpxwMcvbF7B5tjNrWgarMvFi,iv:ngGupc1U9wOu2FKPP8QacO4NmgjH84PLyf2sjwZ0yQ8=,tag:BJr7RvrrrBZMF3OpISan8g==,type:str] _default: ENC[AES256_GCM,data:wTkE2ISxbX2gpObQibxl4wH7FrKtZ2eflbVaVUsImnO6kP2XRDVaKXwqaoKkzE8hztWYOpxwMcvbF7B5tjNrWgarMvFi,iv:ngGupc1U9wOu2FKPP8QacO4NmgjH84PLyf2sjwZ0yQ8=,tag:BJr7RvrrrBZMF3OpISan8g==,type:str]
ACCOUNT_SENDGRID_SENDER: ACCOUNT_SENDGRID_SENDER:
@ -142,8 +138,8 @@ sops:
azure_kv: [] azure_kv: []
hc_vault: [] hc_vault: []
age: [] age: []
lastmodified: "2023-04-11T10:06:27Z" lastmodified: "2023-04-25T10:57:00Z"
mac: ENC[AES256_GCM,data:j8zkQv0+1dkpwCve3blZ9nZ1q9bvnw7uoaVISRDe9iFvv8q00SOvf3Ukb4+xuxGJcAW+FJKNwM++f6ftBubLVpi8hGK78xfulJFMBKhvbziYgRMwceuaX6gcrdBMfkbmo6PmUADD1EcKrmjrNxZozil01fQ0G+D1VHAiAafLifQ=,iv:Y/g6JCilPjUcPpr2CvOSFR8v4STfnvJYjGHCPXpQCcQ=,tag:2LGt74acinC6U0FPtLAhWA==,type:str] mac: ENC[AES256_GCM,data:Qo22V2i49YDjFsQxe0QRRPLHvEyn+FRRU4hw2jzwsMewvDlT8WszxLYYN6WO1HeKWfSxQyijLjnxyWd6244S7M6QRVWJnQw0x5KXznxbuDZvQzcYin6ml4HU72LpBvaDTYDRtAL6YomvHTPtwbd7pzr0Q+R42nZMmxr7Yz7v1X0=,iv:wz+UiVQ4OAoP/T/iXcg+wNgA8pnO0Ns/keHINAhLvb0=,tag:CH5iYwJASwknPi6+qYZ8Dw==,type:str]
pgp: pgp:
- created_at: "2022-10-10T07:37:16Z" - created_at: "2022-10-10T07:37:16Z"
enc: | enc: |

@ -179,8 +179,6 @@ DECODE_NOT_A_CONTRACT_CALLS=true
# ACCOUNT_AUTH0_DOMAIN= # ACCOUNT_AUTH0_DOMAIN=
# ACCOUNT_AUTH0_CLIENT_ID= # ACCOUNT_AUTH0_CLIENT_ID=
# ACCOUNT_AUTH0_CLIENT_SECRET= # ACCOUNT_AUTH0_CLIENT_SECRET=
# ACCOUNT_AUTH0_LOGOUT_URL=
# ACCOUNT_AUTH0_LOGOUT_RETURN_URL=
# ACCOUNT_PUBLIC_TAGS_AIRTABLE_URL= # ACCOUNT_PUBLIC_TAGS_AIRTABLE_URL=
# ACCOUNT_PUBLIC_TAGS_AIRTABLE_API_KEY= # ACCOUNT_PUBLIC_TAGS_AIRTABLE_API_KEY=
# ACCOUNT_SENDGRID_API_KEY= # ACCOUNT_SENDGRID_API_KEY=

@ -621,12 +621,6 @@ endif
ifdef ACCOUNT_AUTH0_CLIENT_SECRET ifdef ACCOUNT_AUTH0_CLIENT_SECRET
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_AUTH0_CLIENT_SECRET=$(ACCOUNT_AUTH0_CLIENT_SECRET)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_AUTH0_CLIENT_SECRET=$(ACCOUNT_AUTH0_CLIENT_SECRET)'
endif endif
ifdef ACCOUNT_AUTH0_LOGOUT_RETURN_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_AUTH0_LOGOUT_RETURN_URL=$(ACCOUNT_AUTH0_LOGOUT_RETURN_URL)'
endif
ifdef ACCOUNT_AUTH0_LOGOUT_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_AUTH0_LOGOUT_URL=$(ACCOUNT_AUTH0_LOGOUT_URL)'
endif
ifdef ACCOUNT_SENDGRID_API_KEY ifdef ACCOUNT_SENDGRID_API_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_SENDGRID_API_KEY=$(ACCOUNT_SENDGRID_API_KEY)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_SENDGRID_API_KEY=$(ACCOUNT_SENDGRID_API_KEY)'
endif endif

Loading…
Cancel
Save