Renamed *DatabaseAuthenticator to *Authenticator.
[akkoma] / lib / pleroma / web / auth / authenticator.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.Auth.Authenticator do
6 alias Pleroma.User
7
8 def implementation do
9 Pleroma.Config.get(
10 Pleroma.Web.Auth.Authenticator,
11 Pleroma.Web.Auth.PleromaAuthenticator
12 )
13 end
14
15 @callback get_user(Plug.Conn.t()) :: {:ok, User.t()} | {:error, any()}
16 def get_user(plug), do: implementation().get_user(plug)
17
18 @callback handle_error(Plug.Conn.t(), any()) :: any()
19 def handle_error(plug, error), do: implementation().handle_error(plug, error)
20
21 @callback auth_template() :: String.t() | nil
22 def auth_template do
23 implementation().auth_template() || Pleroma.Config.get(:auth_template, "show.html")
24 end
25 end