1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.Auth.Authenticator do
10 Pleroma.Web.Auth.Authenticator,
11 Pleroma.Web.Auth.PleromaAuthenticator
15 @callback get_user(Plug.Conn.t(), Map.t()) :: {:ok, User.t()} | {:error, any()}
16 def get_user(plug, params), do: implementation().get_user(plug, params)
18 @callback get_or_create_user_by_oauth(Plug.Conn.t(), Map.t()) ::
19 {:ok, User.t()} | {:error, any()}
20 def get_or_create_user_by_oauth(plug, params),
21 do: implementation().get_or_create_user_by_oauth(plug, params)
23 @callback handle_error(Plug.Conn.t(), any()) :: any()
24 def handle_error(plug, error), do: implementation().handle_error(plug, error)
26 @callback auth_template() :: String.t() | nil
28 implementation().auth_template() || Pleroma.Config.get(:auth_template, "show.html")