aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/auth/ldap_authenticator.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web/auth/ldap_authenticator.ex')
-rw-r--r--lib/pleroma/web/auth/ldap_authenticator.ex10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/pleroma/web/auth/ldap_authenticator.ex b/lib/pleroma/web/auth/ldap_authenticator.ex
index 88217aab8..6c65cff27 100644
--- a/lib/pleroma/web/auth/ldap_authenticator.ex
+++ b/lib/pleroma/web/auth/ldap_authenticator.ex
@@ -12,10 +12,10 @@ defmodule Pleroma.Web.Auth.LDAPAuthenticator do
@connection_timeout 10_000
@search_timeout 10_000
- def get_user(%Plug.Conn{} = conn) do
+ def get_user(%Plug.Conn{} = conn, params) do
if Pleroma.Config.get([:ldap, :enabled]) do
{name, password} =
- case conn.params do
+ case params do
%{"authorization" => %{"name" => name, "password" => password}} ->
{name, password}
@@ -29,17 +29,19 @@ defmodule Pleroma.Web.Auth.LDAPAuthenticator do
{:error, {:ldap_connection_error, _}} ->
# When LDAP is unavailable, try default authenticator
- Pleroma.Web.Auth.PleromaAuthenticator.get_user(conn)
+ Pleroma.Web.Auth.PleromaAuthenticator.get_user(conn, params)
error ->
error
end
else
# Fall back to default authenticator
- Pleroma.Web.Auth.PleromaAuthenticator.get_user(conn)
+ Pleroma.Web.Auth.PleromaAuthenticator.get_user(conn, params)
end
end
+ def get_or_create_user_by_oauth(conn, params), do: get_user(conn, params)
+
def handle_error(%Plug.Conn{} = _conn, error) do
error
end