Advertisement
Guest User

Untitled

a guest
Feb 26th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1.  
  2.  
  3. diff --git a/web/basic_auth.ex b/web/basic_auth.ex
  4. index 474cdb7..001fc21 100644
  5. --- a/web/basic_auth.ex
  6. +++ b/web/basic_auth.ex
  7. @@ -5,9 +5,14 @@ defmodule BasicAuth do
  8. opts
  9. end
  10.  
  11. - def call(conn, opts) do
  12. - conn
  13. - |> send_resp(401, "unauthorized")
  14. - |> halt()
  15. + def call(conn, [username: username, password: password]) do
  16. + case get_req_header(conn, "authorization") do
  17. + ["Basic " <> auth] ->
  18. + conn
  19. + _ ->
  20. + conn
  21. + |> send_resp(401, "unauthorized")
  22. + |> halt()
  23. + end
  24. end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement