mirror of
https://github.com/team-alembic/ash_authentication.git
synced 2024-09-21 05:43:05 +12:00
fix(Jwt): Include authentication interaction context when storing tokens.
This commit is contained in:
parent
d510f5be2c
commit
325b52eca0
1 changed files with 6 additions and 5 deletions
|
@ -120,17 +120,18 @@ defmodule AshAuthentication.Jwt do
|
|||
defp maybe_store_token(token, resource, user, purpose, opts) do
|
||||
if Info.authentication_tokens_store_all_tokens?(resource) do
|
||||
with {:ok, token_resource} <- Info.authentication_tokens_token_resource(resource) do
|
||||
context_patch = %{
|
||||
ash_authentication: %{user: user},
|
||||
private: %{ash_authentication?: true}
|
||||
}
|
||||
|
||||
TokenResource.Actions.store_token(
|
||||
token_resource,
|
||||
%{
|
||||
"token" => token,
|
||||
"purpose" => to_string(purpose)
|
||||
},
|
||||
Keyword.put(opts, :context, %{
|
||||
ash_authentication: %{
|
||||
user: user
|
||||
}
|
||||
})
|
||||
Keyword.update(opts, :context, context_patch, &Map.merge(&1, context_patch))
|
||||
)
|
||||
end
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue