Skip to content

Question on authentication #116

Answered by tfwright
asok asked this question in Q&A
Jul 18, 2024 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Question 1:

LiveAdmin does not currently support any specific auth strategy but since it is just a group of routes it theoretically supports anything you can do in a router pipeline. The easiest way to quickly protect a route is to add basic auth plug, which would look something like this:

  # router.ex

  pipeline :admin do
    plug :admin_user_auth
  end

  scope "/admin" do
    pipe_through [:admin, :browser]

     live_admin "/admin", title: "Wow Project"  do
      admin_resource "/users", Wow.Admin.User
    end
  end

  # see basic auth hex docs for more advanced usage, including individual user accounts 
  defp admin_user_auth(conn, _opts) do
    username = Application.fetch_env!(:y…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@asok
Comment options

Answer selected by asok
Comment options

You must be logged in to vote
1 reply
@asok
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #115 on July 19, 2024 08:50.