Move module to LivebookWeb.ZTA.SessionIdentity

This commit is contained in:
José Valim 2024-04-12 09:49:25 +02:00
parent 25829b420f
commit c93511296a
3 changed files with 4 additions and 4 deletions

View file

@ -695,7 +695,7 @@ defmodule Livebook.Config do
def identity_provider!(env) do def identity_provider!(env) do
case System.get_env(env) do case System.get_env(env) do
nil -> nil ->
{:session, LivebookWeb.SessionIdentity, :unused} {:session, LivebookWeb.ZTA.SessionIdentity, :unused}
"custom:" <> module_key -> "custom:" <> module_key ->
destructure [module, key], String.split(module_key, ":", parts: 2) destructure [module, key], String.split(module_key, ":", parts: 2)

View file

@ -1,4 +1,4 @@
defmodule LivebookWeb.SessionIdentity do defmodule LivebookWeb.ZTA.SessionIdentity do
# This module implements the ZTA contract specific to Livebook cookies # This module implements the ZTA contract specific to Livebook cookies
import Plug.Conn import Plug.Conn

View file

@ -39,9 +39,9 @@ defmodule Livebook.ConfigTest do
assert Config.identity_provider!("TEST_IDENTITY_PROVIDER") == {:custom, Module, nil} assert Config.identity_provider!("TEST_IDENTITY_PROVIDER") == {:custom, Module, nil}
end) end)
with_env([TEST_IDENTITY_PROVIDER: "custom:LivebookWeb.SessionIdentity:extra"], fn -> with_env([TEST_IDENTITY_PROVIDER: "custom:LivebookWeb.ZTA.SessionIdentity:extra"], fn ->
assert Config.identity_provider!("TEST_IDENTITY_PROVIDER") == assert Config.identity_provider!("TEST_IDENTITY_PROVIDER") ==
{:custom, LivebookWeb.SessionIdentity, "extra"} {:custom, LivebookWeb.ZTA.SessionIdentity, "extra"}
end) end)
with_env([TEST_IDENTITY_PROVIDER: "cloudflare:123"], fn -> with_env([TEST_IDENTITY_PROVIDER: "cloudflare:123"], fn ->