From b6571b876947532cc3338b54cd3b21bd0499335f Mon Sep 17 00:00:00 2001 From: angusjf Date: Tue, 16 Jan 2024 14:42:42 +0000 Subject: [PATCH 1/4] update docs & migrate_deprecated_cache_options --- README.md | 3 +-- lib/prima_auth0_ex/application.ex | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e5f2066..2560771 100644 --- a/README.md +++ b/README.md @@ -115,11 +115,10 @@ Note that right now caching is assumed to be all-or-nothing with respect to mult Clients can be configured to use caching through Redis. To use caching you can use the following configuration: ```elixir +# Enables cache on redis for tokens obtained from Auth0. config :prima_auth0_ex, :token_cache, EncryptedRedisTokenCache config :prima_auth0_ex, :redis, - # Enables cache on redis for tokens obtained from Auth0. Defaults to false. - enabled: true, # AES 256 key used to encrypt tokens on the shared cache. # Can be generated via `:crypto.strong_rand_bytes(32) |> Base.encode64()`. encryption_key: "uhOrqKvUi9gHnmwr60P2E1hiCSD2dtXK1i6dqkU4RTA=", diff --git a/lib/prima_auth0_ex/application.ex b/lib/prima_auth0_ex/application.ex index a23d883..de0dea6 100644 --- a/lib/prima_auth0_ex/application.ex +++ b/lib/prima_auth0_ex/application.ex @@ -37,14 +37,24 @@ defmodule PrimaAuth0Ex.Application do Application.put_env(:prima_auth0_ex, :token_cache, EncryptedRedisTokenCache) Logger.warning(""" - The - :prima_auth0_ex, :redis, :enabled option + The + :prima_auth0_ex, :redis, :enabled option is deprecated. Set - :prima_auth0_ex, token_cache: EncryptedRedisTokenCache + :prima_auth0_ex, token_cache: EncryptedRedisTokenCache instead """) + {true, :'Elixir.EncryptedRedisTokenCache'} -> + Logger.warning(""" + The + :prima_auth0_ex, :redis, :enabled option + is deprecated. + Setting + :prima_auth0_ex, token_cache: EncryptedRedisTokenCache + alone is sufficient + """) + {false, nil} -> Application.put_env(:prima_auth0_ex, :token_cache, NoopCache) From 62bbd5d5997f748c01d031cf9edb08686755a043 Mon Sep 17 00:00:00 2001 From: angusjf Date: Tue, 16 Jan 2024 14:46:33 +0000 Subject: [PATCH 2/4] quote style --- lib/prima_auth0_ex/application.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/prima_auth0_ex/application.ex b/lib/prima_auth0_ex/application.ex index de0dea6..b61a645 100644 --- a/lib/prima_auth0_ex/application.ex +++ b/lib/prima_auth0_ex/application.ex @@ -45,7 +45,7 @@ defmodule PrimaAuth0Ex.Application do instead """) - {true, :'Elixir.EncryptedRedisTokenCache'} -> + {true, :"Elixir.EncryptedRedisTokenCache"} -> Logger.warning(""" The :prima_auth0_ex, :redis, :enabled option From 420fcdcc838b6a2d2af21087d39bf5a61919579b Mon Sep 17 00:00:00 2001 From: angusjf Date: Tue, 16 Jan 2024 15:08:42 +0000 Subject: [PATCH 3/4] typo --- lib/prima_auth0_ex/application.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/prima_auth0_ex/application.ex b/lib/prima_auth0_ex/application.ex index b61a645..3151a61 100644 --- a/lib/prima_auth0_ex/application.ex +++ b/lib/prima_auth0_ex/application.ex @@ -27,9 +27,9 @@ defmodule PrimaAuth0Ex.Application do defp migrate_deprecated_cache_options do redis_enabled = Config.redis(:enabled) - cache_provieder = Config.token_cache(nil) + cache_provider = Config.token_cache(nil) - case {redis_enabled, cache_provieder} do + case {redis_enabled, cache_provider} do {nil, _} -> nil From 7c99406b70682140e54d00a8ff5069429cfb69e5 Mon Sep 17 00:00:00 2001 From: Angus Findlay Date: Wed, 17 Jan 2024 16:51:41 +0000 Subject: [PATCH 4/4] Update lib/prima_auth0_ex/application.ex Co-authored-by: Simone Cottini --- lib/prima_auth0_ex/application.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/prima_auth0_ex/application.ex b/lib/prima_auth0_ex/application.ex index 3151a61..386ef48 100644 --- a/lib/prima_auth0_ex/application.ex +++ b/lib/prima_auth0_ex/application.ex @@ -45,13 +45,13 @@ defmodule PrimaAuth0Ex.Application do instead """) - {true, :"Elixir.EncryptedRedisTokenCache"} -> + {true, _} -> Logger.warning(""" The :prima_auth0_ex, :redis, :enabled option is deprecated. Setting - :prima_auth0_ex, token_cache: EncryptedRedisTokenCache + :prima_auth0_ex, token_cache: #{cache_provider} alone is sufficient """)