Database authenticator behaviour / Pleroma implementation refactoring.
[akkoma] / lib / pleroma / web / oauth / oauth_controller.ex
index abe6fd2f239cbd71a93e10f5f1079c7022f96cfc..02c0babd24080f75bc936f0a48aa10b8c1b17c81 100644 (file)
@@ -5,7 +5,7 @@
 defmodule Pleroma.Web.OAuth.OAuthController do
   use Pleroma.Web, :controller
 
-  alias Pleroma.Web.OAuth
+  alias Pleroma.Web.Auth.DatabaseAuthenticator
   alias Pleroma.Web.OAuth.Authorization
   alias Pleroma.Web.OAuth.Token
   alias Pleroma.Web.OAuth.App
@@ -45,7 +45,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
             "redirect_uri" => redirect_uri
           } = auth_params
       }) do
-    with {_, {:ok, %User{} = user}} <- {:get_user, OAuth.authenticator().get_user(conn)},
+    with {_, {:ok, %User{} = user}} <- {:get_user, DatabaseAuthenticator.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, []),
@@ -98,7 +98,7 @@ defmodule Pleroma.Web.OAuth.OAuthController do
         |> authorize(auth_params)
 
       error ->
-        OAuth.authenticator().handle_error(conn, error)
+        DatabaseAuthenticator.handle_error(conn, error)
     end
   end