diff options
| author | Ariadne Conill <ariadne@dereferenced.org> | 2019-07-18 20:31:25 +0000 | 
|---|---|---|
| committer | Ariadne Conill <ariadne@dereferenced.org> | 2019-07-18 20:31:25 +0000 | 
| commit | c947cfec5ab49f90fb2de83f61bda77568298d6f (patch) | |
| tree | d709c0473c597252cd1d041d10dc9fa7580cab09 /lib | |
| parent | 621cacf667e7d5519a2731fadf86c429f70f4489 (diff) | |
| download | pleroma-c947cfec5ab49f90fb2de83f61bda77568298d6f.tar.gz pleroma-c947cfec5ab49f90fb2de83f61bda77568298d6f.zip  | |
mapped signature plug: use `user` assign like authentication plug
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/pleroma/plugs/mapped_signature_to_identity_plug.ex | 6 | 
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pleroma/plugs/mapped_signature_to_identity_plug.ex b/lib/pleroma/plugs/mapped_signature_to_identity_plug.ex index 1e7da4f50..ce8494b9d 100644 --- a/lib/pleroma/plugs/mapped_signature_to_identity_plug.ex +++ b/lib/pleroma/plugs/mapped_signature_to_identity_plug.ex @@ -31,14 +31,14 @@ defmodule Pleroma.Web.Plugs.MappedSignatureToIdentityPlug do      end    end -  def call(%{assigns: %{mapped_identity: _}} = conn, _opts), do: conn +  def call(%{assigns: %{user: _}} = conn, _opts), do: conn    # if this has payload make sure it is signed by the same actor that made it    def call(%{assigns: %{valid_signature: true}, params: %{"actor" => actor}} = conn, _opts) do      with actor_id <- Utils.get_ap_id(actor),           {:user, %User{} = user} <- {:user, user_from_key_id(conn)},           {:user_match, true} <- {:user_match, user.ap_id == actor_id} do -      assign(conn, :mapped_identity, user) +      assign(conn, :user, user)      else        {:user_match, false} ->          Logger.debug("Failed to map identity from signature (payload actor mismatch)") @@ -56,7 +56,7 @@ defmodule Pleroma.Web.Plugs.MappedSignatureToIdentityPlug do    # no payload, probably a signed fetch    def call(%{assigns: %{valid_signature: true}} = conn, _opts) do      with %User{} = user <- user_from_key_id(conn) do -      assign(conn, :mapped_identity, user) +      assign(conn, :user, user)      else        _ ->          Logger.debug("Failed to map identity from signature (no payload actor mismatch)")  | 
