feat: improve oidc only mode
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Simon 2026-03-16 17:14:54 +01:00
parent a8d9fe6121
commit 9b4f3b140c
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
19 changed files with 330 additions and 43 deletions

View file

@ -318,7 +318,7 @@ defmodule MvWeb.AuthControllerTest do
case result do
{:error, {:redirect, %{to: to}}} ->
refute to =~ "sign_in_with_token",
"Expected password sign-in to be rejected when OIDC-only, got redirect to: #{to}"
"Expected password sign-in to be rejected when OIDC-only, got redirect to: #{to}"
_ ->
# LiveView re-rendered (e.g. with flash error) instead of redirecting to success
@ -336,6 +336,7 @@ defmodule MvWeb.AuthControllerTest do
conn: authenticated_conn
} do
{:ok, settings} = Membership.get_settings()
prev = %{
oidc_only: settings.oidc_only,
oidc_client_id: settings.oidc_client_id,

View file

@ -181,13 +181,14 @@ defmodule MvWeb.Plugs.CheckPagePermissionTest do
end
describe "unauthenticated user" do
test "nil current_user is denied and redirected to \"/sign-in\"" do
test "nil current_user is denied and redirected to \"/sign-in\" without access-denied flash" do
conn = conn_without_user("/members") |> CheckPagePermission.call([])
assert conn.halted
assert redirected_to(conn) == "/sign-in"
assert Phoenix.Flash.get(conn.assigns[:flash] || %{}, :error) ==
# Unauthenticated users are redirected to sign-in only; no "no permission" message.
refute Phoenix.Flash.get(conn.assigns[:flash] || %{}, :error) ==
"You don't have permission to access this page."
end
end