aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-11-30 21:55:48 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-11-30 21:55:48 +0300
commitd50a3345ae7873f8a8744eba8a3eb755e2b8dfdc (patch)
tree98a5d9d3463ef4e96fb5f96ab8aa8486dfcf40d2 /lib
parent50e47a215f9c473a308ba7e9ddea5e33099c5a9d (diff)
downloadpleroma-d50a3345ae7873f8a8744eba8a3eb755e2b8dfdc.tar.gz
[#3112] Allowed revoking same-user token from any apps. Added tests.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/masto_fe_controller.ex2
-rw-r--r--lib/pleroma/web/o_auth/o_auth_controller.ex6
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/pleroma/web/masto_fe_controller.ex b/lib/pleroma/web/masto_fe_controller.ex
index 7011ae214..20279ff45 100644
--- a/lib/pleroma/web/masto_fe_controller.ex
+++ b/lib/pleroma/web/masto_fe_controller.ex
@@ -6,8 +6,8 @@ defmodule Pleroma.Web.MastoFEController do
use Pleroma.Web, :controller
alias Pleroma.User
- alias Pleroma.Web.OAuth.Token
alias Pleroma.Web.MastodonAPI.AuthController
+ alias Pleroma.Web.OAuth.Token
alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug
alias Pleroma.Web.Plugs.OAuthScopesPlug
diff --git a/lib/pleroma/web/o_auth/o_auth_controller.ex b/lib/pleroma/web/o_auth/o_auth_controller.ex
index 965c0f879..6e3c7e1a1 100644
--- a/lib/pleroma/web/o_auth/o_auth_controller.ex
+++ b/lib/pleroma/web/o_auth/o_auth_controller.ex
@@ -379,9 +379,9 @@ defmodule Pleroma.Web.OAuth.OAuthController do
render_invalid_credentials_error(conn)
end
- def token_revoke(%Plug.Conn{} = conn, %{"token" => _token} = params) do
- with {:ok, app} <- Token.Utils.fetch_app(conn),
- {:ok, %Token{} = oauth_token} <- RevokeToken.revoke(app, params) do
+ def token_revoke(%Plug.Conn{} = conn, %{"token" => token}) do
+ with {:ok, %Token{} = oauth_token} <- Token.get_by_token(token),
+ {:ok, oauth_token} <- RevokeToken.revoke(oauth_token) do
conn =
with session_token = AuthHelper.get_session_token(conn),
%Token{token: ^session_token} <- oauth_token do