ExTeal.AuthProvider behaviour (ExTeal v0.21.0) View Source

Interface for providing authorization and authentication to ExTeal.

Link to this section Summary

Types

Data to be displayed on the front end

Callbacks

Used to display the current user on the nav bar.

Used to build the content of the dropdown menu for a user.

Link to this section Types

Specs

user_payload() :: %{name: String.t() | nil, avatar_url: String.t() | nil}

Data to be displayed on the front end

Link to this section Callbacks

Specs

current_user_for(Plug.Conn.t()) :: user_payload()

Used to display the current user on the nav bar.

Should return a user_payload map. If your User struct does not have a user image associated with it, consider using the gravatar api.

Specs

dropdown_content(Plug.Conn.t()) :: [String.t()]

Used to build the content of the dropdown menu for a user.

The content of the user dropdown is dynamic and can be overriden to provide additional links and html.

The function should return a list of strings that will be used to build list elements.