fix: bug where nil is not allowed but is returned from secret functions.

This commit is contained in:
James Harton 2024-08-19 09:05:59 +12:00
parent 59d143583f
commit ef1b12258b
Signed by: james
GPG key ID: 90E82DAA13F624F4

View file

@ -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)}