Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Merge #448
Browse files Browse the repository at this point in the history
448: Do not authenticate the wobserver API r=notriddle a=notriddle

Wobserver uses its own authentication key, so we can forward anything in and let it take care of it.

Fixes https://forum.bors.tech/t/accessing-wobserver/201/8

Co-authored-by: Michael Howell <michael@notriddle.com>
  • Loading branch information
bors[bot] and notriddle committed Aug 17, 2018
2 parents 24866f3 + af234b7 commit 585dc1c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ defmodule BorsNG.Router do
end

pipeline :wobserver do
plug :fetch_session
plug :get_current_user
plug :force_current_user_admin
plug :wobserver_auth
end

pipeline :webhook do
Expand Down Expand Up @@ -148,4 +146,17 @@ defmodule BorsNG.Router do
|> halt
end
end

# If the target URL is in the wobserver API, do not mess with it.
# Otherwise, authenticate the current user.
defp wobserver_auth(conn, _) do
case conn.path_info do
["api", _] -> conn
_ ->
conn
|> fetch_session([])
|> get_current_user([])
|> force_current_user_admin([])
end
end
end

0 comments on commit 585dc1c

Please sign in to comment.