Pbkdf2: Use it everywhere.

This commit is contained in:
Lain Soykaf 2021-01-14 15:06:16 +01:00
commit 39f3683a06
21 changed files with 37 additions and 127 deletions

View file

@ -18,7 +18,7 @@ defmodule Pleroma.Web.OAuth.LDAPAuthorizationTest do
@tag @skip
test "authorizes the existing user using LDAP credentials" do
password = "testpassword"
user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password))
user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password))
app = insert(:oauth_app, scopes: ["read", "write"])
host = Pleroma.Config.get([:ldap, :host]) |> to_charlist
@ -101,7 +101,7 @@ defmodule Pleroma.Web.OAuth.LDAPAuthorizationTest do
@tag @skip
test "disallow authorization for wrong LDAP credentials" do
password = "testpassword"
user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password))
user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password))
app = insert(:oauth_app, scopes: ["read", "write"])
host = Pleroma.Config.get([:ldap, :host]) |> to_charlist

View file

@ -20,7 +20,7 @@ defmodule Pleroma.Web.OAuth.MFAControllerTest do
insert(:user,
multi_factor_authentication_settings: %MFA.Settings{
enabled: true,
backup_codes: [Pleroma.Password.hash_pwd_salt("test-code")],
backup_codes: [Pleroma.Password.Pbkdf2.hash_pwd_salt("test-code")],
totp: %MFA.Settings.TOTP{secret: otp_secret, confirmed: true}
}
)
@ -246,7 +246,7 @@ defmodule Pleroma.Web.OAuth.MFAControllerTest do
hashed_codes =
backup_codes
|> Enum.map(&Pleroma.Password.hash_pwd_salt(&1))
|> Enum.map(&Pleroma.Password.Pbkdf2.hash_pwd_salt(&1))
user =
insert(:user,

View file

@ -316,7 +316,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
app: app,
conn: conn
} do
user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt("testpassword"))
user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("testpassword"))
registration = insert(:registration, user: nil)
redirect_uri = OAuthController.default_redirect_uri(app)
@ -347,7 +347,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
app: app,
conn: conn
} do
user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt("testpassword"))
user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("testpassword"))
registration = insert(:registration, user: nil)
unlisted_redirect_uri = "http://cross-site-request.com"
@ -790,7 +790,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
test "issues a token for `password` grant_type with valid credentials, with full permissions by default" do
password = "testpassword"
user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password))
user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password))
app = insert(:oauth_app, scopes: ["read", "write"])
@ -818,7 +818,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
user =
insert(:user,
password_hash: Pleroma.Password.hash_pwd_salt(password),
password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password),
multi_factor_authentication_settings: %MFA.Settings{
enabled: true,
totp: %MFA.Settings.TOTP{secret: otp_secret, confirmed: true}
@ -927,7 +927,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
password = "testpassword"
{:ok, user} =
insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password))
insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password))
|> User.confirmation_changeset(need_confirmation: true)
|> User.update_and_set_cache()
@ -955,7 +955,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
user =
insert(:user,
password_hash: Pleroma.Password.hash_pwd_salt(password),
password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password),
deactivated: true
)
@ -983,7 +983,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
user =
insert(:user,
password_hash: Pleroma.Password.hash_pwd_salt(password),
password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password),
password_reset_pending: true
)
@ -1012,7 +1012,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
user =
insert(:user,
password_hash: Pleroma.Password.hash_pwd_salt(password),
password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password),
confirmation_pending: true
)
@ -1040,7 +1040,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do
user =
insert(:user,
password_hash: Pleroma.Password.hash_pwd_salt(password),
password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password),
approval_pending: true
)