1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 # A test controller reachable only in :test env.
6 # Serves to test OAuth scopes check skipping / enforcement.
7 defmodule Pleroma.Tests.OAuthTestController do
10 use Pleroma.Web, :controller
12 alias Pleroma.Plugs.OAuthScopesPlug
14 plug(:skip_plug, OAuthScopesPlug when action == :skipped_oauth)
16 plug(OAuthScopesPlug, %{scopes: ["read"]} when action != :missed_oauth)
18 def skipped_oauth(conn, _params) do
22 def performed_oauth(conn, _params) do
26 def missed_oauth(conn, _params) do
30 defp noop(conn), do: json(conn, %{})