Made auth customization be runtime-configurable.
This commit is contained in:
parent
e98d34e5fb
commit
b6f915313f
3 changed files with 14 additions and 8 deletions
|
|
@ -5,14 +5,16 @@
|
|||
defmodule Pleroma.Web.Auth.DatabaseAuthenticator do
|
||||
alias Pleroma.User
|
||||
|
||||
@implementation Pleroma.Config.get(
|
||||
Pleroma.Web.Auth.DatabaseAuthenticator,
|
||||
Pleroma.Web.Auth.PleromaDatabaseAuthenticator
|
||||
)
|
||||
def implementation do
|
||||
Pleroma.Config.get(
|
||||
Pleroma.Web.Auth.DatabaseAuthenticator,
|
||||
Pleroma.Web.Auth.PleromaDatabaseAuthenticator
|
||||
)
|
||||
end
|
||||
|
||||
@callback get_user(Plug.Conn.t()) :: {:ok, User.t()} | {:error, any()}
|
||||
defdelegate get_user(plug), to: @implementation
|
||||
def get_user(plug), do: implementation().get_user(plug)
|
||||
|
||||
@callback handle_error(Plug.Conn.t(), any()) :: any()
|
||||
defdelegate handle_error(plug, error), to: @implementation
|
||||
def handle_error(plug, error), do: implementation().handle_error(plug, error)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue