Create WrapperAuthenticator and simplify Authenticator behaviour
[akkoma] / lib / pleroma / web / auth / authenticator.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.Auth.Authenticator do
6 @callback get_user(Plug.Conn.t()) :: {:ok, user :: struct()} | {:error, any()}
7 @callback create_from_registration(Plug.Conn.t(), registration :: struct()) ::
8 {:ok, User.t()} | {:error, any()}
9 @callback get_registration(Plug.Conn.t()) :: {:ok, registration :: struct()} | {:error, any()}
10 @callback handle_error(Plug.Conn.t(), any()) :: any()
11 @callback auth_template() :: String.t() | nil
12 @callback oauth_consumer_template() :: String.t() | nil
13 end