AshAuthentication.Phoenix.Components.Helpers (ash_authentication_phoenix v2.13.1)

View Source

Helpers which are commonly needed inside the various components.

Summary

Functions

Logs all form errors when debug_authentication_failures? is configured to true

The LiveView Socket contains a reference to the Phoenix endpoint, and from there we can extract the otp_app of the current request.

Returns the name of the remember me field name if any for the given strategy. It does this by looking for the presence of RememberMe.MaybeGenerateTokenPreparation (for read actions) or RememberMe.MaybeGenerateTokenChange (for create actions) and the name of the argument that it is expecting.

The LiveView Socket contains a refererence to the Phoenix router, and from there we can generate the name of the route helpers module.

Functions

auth_path(socket, subject_name, auth_routes_prefix, strategy, phase, params \\ %{})

debug_form_errors(form)

Logs all form errors when debug_authentication_failures? is configured to true

otp_app_from_socket(socket)

@spec otp_app_from_socket(Phoenix.LiveView.Socket.t()) :: atom()

The LiveView Socket contains a reference to the Phoenix endpoint, and from there we can extract the otp_app of the current request.

This is pulled from assigns[:otp_app], or inferred from the socket if that is not set.

remember_me_field(strategy)

@spec remember_me_field(AshAuthentication.Strategy.t()) :: atom() | nil

Returns the name of the remember me field name if any for the given strategy. It does this by looking for the presence of RememberMe.MaybeGenerateTokenPreparation (for read actions) or RememberMe.MaybeGenerateTokenChange (for create actions) and the name of the argument that it is expecting.

route_helpers(socket)

@spec route_helpers(Phoenix.LiveView.Socket.t()) :: module()

The LiveView Socket contains a refererence to the Phoenix router, and from there we can generate the name of the route helpers module.