Build with filtered source
Further nixos module fixes Add tailwind and esbuild to assets build Handle domain on session cookies correctly
This commit is contained in:
@@ -8,11 +8,23 @@ defmodule SsoBsnWeb.Endpoint do
|
||||
store: :cookie,
|
||||
key: "_sso_bsn_key",
|
||||
signing_salt: "2YoB6zeO",
|
||||
same_site: "Lax",
|
||||
# domain: Application.get_env(:sso_bsn, :session_domain)
|
||||
same_site: "Lax"
|
||||
]
|
||||
|
||||
socket "/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]]
|
||||
def domain(), do: Application.get_env(:sso_bsn, :session_domain)
|
||||
def session_options(opts),
|
||||
do: Keyword.put(opts, :domain, domain())
|
||||
|
||||
defmodule RuntimeDomainSession do
|
||||
def init(opts), do: Plug.Session.init(opts)
|
||||
|
||||
def call(conn, opts) do
|
||||
Plug.Session.call(conn, opts |> Map.update(:cookie_opts, [], &(Keyword.put(&1, :domain, SsoBsnWeb.Endpoint.domain()))))
|
||||
end
|
||||
end
|
||||
|
||||
socket "/live", Phoenix.LiveView.Socket,
|
||||
websocket: [connect_info: [session: {__MODULE__, :session_options, [@session_options]}]]
|
||||
|
||||
# Serve at "/" the static files from "priv/static" directory.
|
||||
#
|
||||
@@ -21,7 +33,7 @@ defmodule SsoBsnWeb.Endpoint do
|
||||
plug Plug.Static,
|
||||
at: "/",
|
||||
from: :sso_bsn,
|
||||
gzip: false,
|
||||
gzip: true,
|
||||
only: SsoBsnWeb.static_paths()
|
||||
|
||||
# Code reloading can be explicitly enabled under the
|
||||
@@ -47,6 +59,6 @@ defmodule SsoBsnWeb.Endpoint do
|
||||
|
||||
plug Plug.MethodOverride
|
||||
plug Plug.Head
|
||||
plug Plug.Session, @session_options
|
||||
plug RuntimeDomainSession, @session_options
|
||||
plug SsoBsnWeb.Router
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user