mirror of
https://github.com/team-alembic/ash_authentication.git
synced 2024-09-21 13:53:25 +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
|
defp maybe_store_token(token, resource, user, purpose, opts) do
|
||||||
if Info.authentication_tokens_store_all_tokens?(resource) do
|
if Info.authentication_tokens_store_all_tokens?(resource) do
|
||||||
with {:ok, token_resource} <- Info.authentication_tokens_token_resource(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(
|
TokenResource.Actions.store_token(
|
||||||
token_resource,
|
token_resource,
|
||||||
%{
|
%{
|
||||||
"token" => token,
|
"token" => token,
|
||||||
"purpose" => to_string(purpose)
|
"purpose" => to_string(purpose)
|
||||||
},
|
},
|
||||||
Keyword.put(opts, :context, %{
|
Keyword.update(opts, :context, context_patch, &Map.merge(&1, context_patch))
|
||||||
ash_authentication: %{
|
|
||||||
user: user
|
|
||||||
}
|
|
||||||
})
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue