From 25adf0490365daaae5dd029dd2763a0ddc30ea76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemek=20Draga=C5=84czuk?= Date: Tue, 24 Mar 2020 07:53:17 +0100 Subject: [PATCH] Cleaned up the auth a bit --- src/main/java/tk/draganczuk/url/App.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/tk/draganczuk/url/App.java b/src/main/java/tk/draganczuk/url/App.java index 603e690..4258751 100644 --- a/src/main/java/tk/draganczuk/url/App.java +++ b/src/main/java/tk/draganczuk/url/App.java @@ -22,9 +22,11 @@ public class App { // Add GZIP compression after(Filters::addGZIP); - // Authenticate - Filter authFilter = Filters.createAuthFilter(); - before("/index.html", authFilter); + // No need to auth in dev + if(System.getenv("dev") == null) { + // Authenticate + before("/api/*", Filters.createAuthFilter()); + } get("/", (req, res) -> { res.redirect("/index.html"); @@ -33,7 +35,6 @@ public class App { path("/api", () -> { - before("/*", authFilter); get("/all", Routes::getAll); post("/new", Routes::addUrl); delete("/:shortUrl", Routes::delete);