Currently, it is not possible to configure options, such as load options, when retrieving a user from a token using AshAuthentication.Plug.Helpers.retrieve_from_session/2.
I propose modifying the AshAuthentication.Plug.Helpers.retrieve_from_session/2 function to accept opts as an additional argument. This change would allow greater flexibility when loading users from tokens and make the function more versatile for different use cases.
Here is an example of how the function could be adjusted to accommodate opts.
defmodule AshAuthentication.Plug.Helpers do
...
def retrieve_from_session(conn, otp_app, opts \\ []) do
...
{:ok, user} <-
AshAuthentication.subject_to_user(subject, resource, [
tenant: Ash.PlugHelpers.get_tenant(conn),
context: Ash.PlugHelpers.get_context(conn) || %{}
] |> Keyword.merge(opts))
...
end
end
defmodule AshAuthentication.Plug.Macros do
...
defmacro define_load_from_session(otp_app) do
quote do
def load_from_session(conn, opts),
do: Helpers.retrieve_from_session(conn, unquote(otp_app), opts)
end
end
end
end
Currently, it is not possible to configure options, such as
load
options, when retrieving a user from a token usingAshAuthentication.Plug.Helpers.retrieve_from_session/2
.I propose modifying the
AshAuthentication.Plug.Helpers.retrieve_from_session/2
function to accept opts as an additional argument. This change would allow greater flexibility when loading users from tokens and make the function more versatile for different use cases.Here is an example of how the function could be adjusted to accommodate opts.