Commit 5697d1c5 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'api-read-no-basic-auth' into 'master'

Don't enforce Basic Auth for GET API actions

See merge request !4
parents 1bccb11a 54f6f026
......@@ -6,6 +6,8 @@ defmodule ILoveApiWeb.Api.ScoreController do
alias ILoveApi.Accounts
alias ILoveApi.Accounts.User
plug BasicAuth, [use_config: {:i_love_api, :admin_basic_auth}] when not action in [:index, :show]
action_fallback ILoveApiWeb.Api.FallbackController
def index(conn, _params) do
......
......@@ -4,6 +4,8 @@ defmodule ILoveApiWeb.Api.UserController do
alias ILoveApi.Accounts.User
alias ILoveApi.Accounts
plug BasicAuth, [use_config: {:i_love_api, :admin_basic_auth}] when not action in [:index, :show]
action_fallback ILoveApiWeb.Api.FallbackController
def index(conn, _params) do
......
......@@ -12,7 +12,6 @@ defmodule ILoveApiWeb.Router do
pipeline :api do
plug :accepts, ["json"]
plug BasicAuth, use_config: {:i_love_api, :admin_basic_auth}
end
scope path: "/admin", as: :admin, alias: ILoveApiWeb do
......
......@@ -51,17 +51,8 @@ defmodule ILoveApiWeb.Api.ScoreControllerTest do
[score: fixture(:score)]
end
describe "GET /scores without basic auth credentials" do
test "prevents access", %{conn: conn} do
conn = conn
|> get(api_score_path(conn, :index))
assert response(conn, 401)
end
end
describe "GET /scores with basic auth credentials and a score" do
setup [:setup_score, :setup_basic_auth]
describe "GET /scores without basic auth credentials and a score" do
setup [:setup_score]
test "returns all scores", %{conn: conn} do
conn = conn
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment