Skip to content

Commit

Permalink
remove unsused endpoint and oauth authentication, prepare for phx 1.3 #…
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonLab committed Jan 8, 2018
1 parent 3e55313 commit 40e19d5
Show file tree
Hide file tree
Showing 17 changed files with 5 additions and 284 deletions.
14 changes: 0 additions & 14 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]

# Configer Ueberauth providers
config :ueberauth, Ueberauth,
base_path: "/auth",
providers: [
github: {
Ueberauth.Strategy.Github,
[request_path: "/auth/github", callback_path: "/auth/github/callback"]
}
]

config :ueberauth, Ueberauth.Strategy.Github.OAuth,
client_id: System.get_env("GITHUB_CLIENT_ID"),
client_secret: System.get_env("GITHUB_CLIENT_SECRET")

# define name of the github application
config :dwylbot, :github_app_name, System.get_env("GITHUB_APP_NAME")

Expand Down
5 changes: 1 addition & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ defmodule Dwylbot.Mixfile do
def application do
[mod: {Dwylbot, []},
applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext,
:phoenix_ecto, :postgrex, :ueberauth, :ueberauth_github, :httpoison,
:joken, :jose]]
:phoenix_ecto, :postgrex, :httpoison, :joken, :jose]]
end

# Specifies which paths to compile per environment.
Expand All @@ -42,8 +41,6 @@ defmodule Dwylbot.Mixfile do
{:gettext, "~> 0.11"},
{:cowboy, "~> 1.0"},
{:excoveralls, "~> 0.6", only: :test},
{:ueberauth, "~> 0.4"},
{:ueberauth_github, "~> 0.4.1"},
{:credo, "~> 0.7.4"},
{:httpoison, "~> 0.11.2"},
{:joken, "~> 1.4.1"},
Expand Down
29 changes: 0 additions & 29 deletions test/controllers/auth_controller_test.exs

This file was deleted.

41 changes: 0 additions & 41 deletions test/controllers/installation_controller_test.exs

This file was deleted.

14 changes: 0 additions & 14 deletions test/controllers/page_controller_test.exs
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
defmodule Dwylbot.PageControllerTest do
use Dwylbot.ConnCase
setup %{conn: conn} = config do
if name = config[:login_as] do
user = %{username: name, token: "1"}
conn = assign(conn, :user, user)
{:ok, conn: conn, user: user}
else
:ok
end
end

test "GET /", %{conn: conn} do
conn = get conn, "/"
assert html_response(conn, 200) =~ "Welcome to dwylbot"
end

@tag login_as: "Simon"
test "GET / - user authenticated", %{conn: conn} do
conn = get conn, "/"
assert html_response(conn, 200) =~ "Welcome Simon"
end
end
14 changes: 0 additions & 14 deletions updates.md

This file was deleted.

42 changes: 0 additions & 42 deletions web/controllers/auth.ex

This file was deleted.

27 changes: 0 additions & 27 deletions web/controllers/auth_controller.ex

This file was deleted.

20 changes: 0 additions & 20 deletions web/controllers/installation_controller.ex

This file was deleted.

30 changes: 0 additions & 30 deletions web/controllers/session_controller.ex

This file was deleted.

11 changes: 0 additions & 11 deletions web/router.ex
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
defmodule Dwylbot.Router do
use Dwylbot.Web, :router
require Ueberauth

pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug Dwylbot.Auth
end

pipeline :api do
Expand All @@ -19,15 +17,6 @@ defmodule Dwylbot.Router do
pipe_through :browser

get "/", PageController, :index
resources "/installation", InstallationController, only: [:index, :show]
end

scope "/auth", Dwylbot do
pipe_through :browser

get "/github", AuthController, :request
get "/github/callback", AuthController, :callback
delete "/logout", AuthController, :delete
end

scope "/event", Dwylbot do
Expand Down
10 changes: 0 additions & 10 deletions web/templates/installation/index.html.eex

This file was deleted.

9 changes: 0 additions & 9 deletions web/templates/installation/show.html.eex

This file was deleted.

16 changes: 4 additions & 12 deletions web/templates/page/index.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,8 @@ so everyone can communicate better and work as a team.<br />

<a href="https://github.com/dwyl/dwylbot"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
<br />
<%= if @current_user do %>
<div class="jumbotron">
<h2>Welcome <%= @current_user.username %>!</h2>

<%= link "See your dwylbot installations", to: installation_path(@conn, :index), class: "btn btn-primary" %>
<%= link "Logout", to: auth_path(@conn, :delete), method: :delete, class: "btn btn-danger" %>
</div>
<% else %>
<a class="btn btn-primary btn-lg" href="https://github.com/apps/<%= @app_name %>">
<i class="fa fa-github"></i>
Manage dwylbot installations
</a>
<% end %>
<a class="btn btn-primary btn-lg" href="https://github.com/apps/<%= @app_name %>">
<i class="fa fa-github"></i>
Manage dwylbot installations
</a>
3 changes: 0 additions & 3 deletions web/views/auth_view.ex

This file was deleted.

3 changes: 0 additions & 3 deletions web/views/installation_view.ex

This file was deleted.

1 change: 0 additions & 1 deletion web/web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ defmodule Dwylbot.Web do

import Dwylbot.Router.Helpers
import Dwylbot.Gettext
import Dwylbot.Auth, only: [authenticate_user: 2]
end
end

Expand Down

0 comments on commit 40e19d5

Please sign in to comment.