1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Helpers.AuthHelper do
6 alias Pleroma.Web.Plugs.OAuthScopesPlug
11 Skips OAuth permissions (scopes) checks, assigns nil `:token`.
12 Intended to be used with explicit authentication and only when OAuth token cannot be determined.
14 def skip_oauth(conn) do
16 |> assign(:token, nil)
17 |> OAuthScopesPlug.skip_plug()
20 @doc "Drops authentication info from connection"
21 def drop_auth_info(conn) do
22 # To simplify debugging, setting a private variable on `conn` if auth info is dropped
25 |> assign(:token, nil)
26 |> put_private(:authentication_ignored, true)