src/rally_runtime@auth.erl

-module(rally_runtime@auth).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/rally_runtime/auth.gleam").
-export_type([auth_policy/0, load_result/1, cookie/0]).

-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.

?MODULEDOC(
    " Types for Rally's auth framework. These are used in page modules\n"
    " (via `pub const page_auth = auth.Required`) and in SSR load functions\n"
    " (via `LoadResult` return types). The auth module itself (resolve,\n"
    " is_authenticated, authorize) is defined per-namespace by the app;\n"
    " these types are the contract Rally expects.\n"
).

-type auth_policy() :: required | optional.

-type load_result(AKVP) :: {page, AKVP, list(cookie())} |
    {redirect, binary(), list(cookie())}.

-type cookie() :: {set_cookie, binary(), binary(), integer()} |
    {clear_cookie, binary()}.