Advertisement
Guest User

Untitled

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