Renamed *DatabaseAuthenticator to *Authenticator.
authorIvan Tashkinov <ivantashkinov@gmail.com>
Thu, 28 Feb 2019 11:12:41 +0000 (14:12 +0300)
committerIvan Tashkinov <ivantashkinov@gmail.com>
Thu, 28 Feb 2019 11:12:41 +0000 (14:12 +0300)
lib/pleroma/web/auth/authenticator.ex [moved from lib/pleroma/web/auth/database_authenticator.ex with 81% similarity]
lib/pleroma/web/auth/pleroma_authenticator.ex [moved from lib/pleroma/web/auth/pleroma_database_authenticator.ex with 85% similarity]
lib/pleroma/web/oauth/oauth_controller.ex

similarity index 81%
rename from lib/pleroma/web/auth/database_authenticator.ex
rename to lib/pleroma/web/auth/authenticator.ex
index 494f28f23590ada1f55baed1c62fa6b4e8eb6c8f..82267c5952a6a9b94cfb36f55287150ffb5228f5 100644 (file)
@@ -2,13 +2,13 @@
 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
-defmodule Pleroma.Web.Auth.DatabaseAuthenticator do
+defmodule Pleroma.Web.Auth.Authenticator do
   alias Pleroma.User
 
   def implementation do
     Pleroma.Config.get(
-      Pleroma.Web.Auth.DatabaseAuthenticator,
-      Pleroma.Web.Auth.PleromaDatabaseAuthenticator
+      Pleroma.Web.Auth.Authenticator,
+      Pleroma.Web.Auth.PleromaAuthenticator
     )
   end
 
similarity index 85%
rename from lib/pleroma/web/auth/pleroma_database_authenticator.ex
rename to lib/pleroma/web/auth/pleroma_authenticator.ex
index 0780388bca4ab2de2386dc7dceb5d6d7e90e6e3b..3cc19af016446c08c9fc73a29751db746e226fae 100644 (file)
@@ -2,11 +2,11 @@
 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
-defmodule Pleroma.Web.Auth.PleromaDatabaseAuthenticator do
+defmodule Pleroma.Web.Auth.PleromaAuthenticator do
   alias Pleroma.User
   alias Comeonin.Pbkdf2
 
-  @behaviour Pleroma.Web.Auth.DatabaseAuthenticator
+  @behaviour Pleroma.Web.Auth.Authenticator
 
   def get_user(%Plug.Conn{} = conn) do
     %{"authorization" => %{"name" => name, "password" => password}} = conn.params
index 99346f3991c03b0dc731391b1430e27fcd19df90..b16e3b2a782f1759a6e7a32ab87e9e81f20c9ee3 100644 (file)
@@ -5,7 +5,7 @@
 defmodule Pleroma.Web.OAuth.OAuthController do
   use Pleroma.Web, :controller
 
-  alias Pleroma.Web.Auth.DatabaseAuthenticator
+  alias Pleroma.Web.Auth.Authenticator
   alias Pleroma.Web.OAuth.Authorization
   alias Pleroma.Web.OAuth.Token
   alias Pleroma.Web.OAuth.App
@@ -25,7 +25,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
     available_scopes = (app && app.scopes) || []
     scopes = oauth_scopes(params, nil) || available_scopes
 
-    render(conn, DatabaseAuthenticator.auth_template(), %{
+    render(conn, Authenticator.auth_template(), %{
       response_type: params["response_type"],
       client_id: params["client_id"],
       available_scopes: available_scopes,
@@ -43,7 +43,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
             "redirect_uri" => redirect_uri
           } = auth_params
       }) do
-    with {_, {:ok, %User{} = user}} <- {:get_user, DatabaseAuthenticator.get_user(conn)},
+    with {_, {:ok, %User{} = user}} <- {:get_user, Authenticator.get_user(conn)},
          %App{} = app <- Repo.get_by(App, client_id: client_id),
          true <- redirect_uri in String.split(app.redirect_uris),
          scopes <- oauth_scopes(auth_params, []),
@@ -96,7 +96,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
         |> authorize(auth_params)
 
       error ->
-        DatabaseAuthenticator.handle_error(conn, error)
+        Authenticator.handle_error(conn, error)
     end
   end