From ef1b12258b5ac4e7d11d994e042faa8b5efe8976 Mon Sep 17 00:00:00 2001 From: James Harton Date: Mon, 19 Aug 2024 09:05:59 +1200 Subject: [PATCH] fix: bug where `nil` is not allowed but is returned from secret functions. --- lib/ash_authentication/strategies/oauth2/plug.ex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ash_authentication/strategies/oauth2/plug.ex b/lib/ash_authentication/strategies/oauth2/plug.ex index d5cc1ad..ee141a0 100644 --- a/lib/ash_authentication/strategies/oauth2/plug.ex +++ b/lib/ash_authentication/strategies/oauth2/plug.ex @@ -153,6 +153,10 @@ defmodule AshAuthentication.Strategy.OAuth2.Plug do {:ok, nil} when allow_nil? -> {:ok, config} + {:ok, nil} -> + path = [:authentication, :strategies, strategy.name, secret_name] + {:error, Errors.MissingSecret.exception(path: path, resource: strategy.resource)} + {:ok, value} when is_binary(value) and byte_size(value) > 0 -> {:ok, Map.put(config, secret_name, value)}