[#1682] Fixed Basic Auth permissions issue by disabling OAuth scopes checks when password is provided. Refactored plugs skipping functionality.
This commit is contained in:
parent
e0d7847bc5
commit
66f55106bd
9 changed files with 101 additions and 23 deletions
|
|
@ -6,6 +6,8 @@ defmodule Pleroma.Plugs.AuthenticationPlugTest do
|
|||
use Pleroma.Web.ConnCase, async: true
|
||||
|
||||
alias Pleroma.Plugs.AuthenticationPlug
|
||||
alias Pleroma.Plugs.OAuthScopesPlug
|
||||
alias Pleroma.Plugs.PlugHelper
|
||||
alias Pleroma.User
|
||||
|
||||
import ExUnit.CaptureLog
|
||||
|
|
@ -36,13 +38,16 @@ defmodule Pleroma.Plugs.AuthenticationPlugTest do
|
|||
assert ret_conn == conn
|
||||
end
|
||||
|
||||
test "with a correct password in the credentials, it assigns the auth_user", %{conn: conn} do
|
||||
test "with a correct password in the credentials, " <>
|
||||
"it assigns the auth_user and marks OAuthScopesPlug as skipped",
|
||||
%{conn: conn} do
|
||||
conn =
|
||||
conn
|
||||
|> assign(:auth_credentials, %{password: "guy"})
|
||||
|> AuthenticationPlug.call(%{})
|
||||
|
||||
assert conn.assigns.user == conn.assigns.auth_user
|
||||
assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
|
||||
end
|
||||
|
||||
test "with a wrong password in the credentials, it does nothing", %{conn: conn} do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue