6e29c006a6afc69453ec821cf073512bf753a2a1
[akkoma] / lib / pleroma / helpers / auth_helper.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Helpers.AuthHelper do
6 alias Pleroma.Web.Plugs.OAuthScopesPlug
7
8 @doc """
9 Skips OAuth permissions (scopes) checks, assigns nil `:token`.
10 Intended to be used with explicit authentication and only when OAuth token cannot be determined.
11 """
12 def skip_oauth(conn) do
13 conn
14 |> Plug.Conn.assign(:token, nil)
15 |> OAuthScopesPlug.skip_plug()
16 end
17 end