aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/helpers')
-rw-r--r--lib/pleroma/helpers/auth_helper.ex10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/pleroma/helpers/auth_helper.ex b/lib/pleroma/helpers/auth_helper.ex
index 6e29c006a..878fec346 100644
--- a/lib/pleroma/helpers/auth_helper.ex
+++ b/lib/pleroma/helpers/auth_helper.ex
@@ -5,13 +5,21 @@
defmodule Pleroma.Helpers.AuthHelper do
alias Pleroma.Web.Plugs.OAuthScopesPlug
+ import Plug.Conn
+
@doc """
Skips OAuth permissions (scopes) checks, assigns nil `:token`.
Intended to be used with explicit authentication and only when OAuth token cannot be determined.
"""
def skip_oauth(conn) do
conn
- |> Plug.Conn.assign(:token, nil)
+ |> assign(:token, nil)
|> OAuthScopesPlug.skip_plug()
end
+
+ def drop_auth_info(conn) do
+ conn
+ |> assign(:user, nil)
+ |> assign(:token, nil)
+ end
end