From 441cf59a4fdd510030605f71446385316d532cd8 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Fri, 24 May 2019 07:50:49 +0200 Subject: [PATCH] ~ someone removed the password parameter Signed-off-by: Johannes Theiner #SPM-25: add work 20m testing --- .../de/hsel/spm/baudas/analysis/ShoppingTimes.java | 2 +- .../hsel/spm/baudas/web/AuthenticationFilter.java | 13 +++---------- .../java/de/hsel/spm/baudas/web/LoginServlet.java | 6 +++--- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/main/java/de/hsel/spm/baudas/analysis/ShoppingTimes.java b/src/main/java/de/hsel/spm/baudas/analysis/ShoppingTimes.java index 4c4a697..ed99ee2 100644 --- a/src/main/java/de/hsel/spm/baudas/analysis/ShoppingTimes.java +++ b/src/main/java/de/hsel/spm/baudas/analysis/ShoppingTimes.java @@ -27,7 +27,7 @@ public class ShoppingTimes implements Analysis> { /** * get customer count at specific times. * - * @return Map of Day-Hour Combinations and the corresponding customer count + * @return Map of Day-Hour Combinations and the corresponding user count */ @Override public Map getResult() { diff --git a/src/main/java/de/hsel/spm/baudas/web/AuthenticationFilter.java b/src/main/java/de/hsel/spm/baudas/web/AuthenticationFilter.java index aa28ce4..d262553 100644 --- a/src/main/java/de/hsel/spm/baudas/web/AuthenticationFilter.java +++ b/src/main/java/de/hsel/spm/baudas/web/AuthenticationFilter.java @@ -1,18 +1,11 @@ package de.hsel.spm.baudas.web; -import java.io.IOException; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; +import javax.servlet.*; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import java.io.IOException; /** * Filter implementation class AuthenticationFilter. @@ -51,7 +44,7 @@ public class AuthenticationFilter implements Filter{ String url = req.getRequestURI(); if(url.contains("login") || url.contains("logo") || url.contains("js/")){ chain.doFilter(request, response); - } else if (session == null || !((boolean) session.getAttribute("authentication"))) { //checking whether the session exists and if authentication succeded + } else if (session == null || !((boolean) session.getAttribute("authentication"))) { //checking whether the session exists and if authentication succeed this.context.log("Unauthorized access request"); res.sendRedirect(req.getContextPath() + "/login.html"); } else { diff --git a/src/main/java/de/hsel/spm/baudas/web/LoginServlet.java b/src/main/java/de/hsel/spm/baudas/web/LoginServlet.java index e9e2e6c..ce33667 100644 --- a/src/main/java/de/hsel/spm/baudas/web/LoginServlet.java +++ b/src/main/java/de/hsel/spm/baudas/web/LoginServlet.java @@ -1,8 +1,5 @@ package de.hsel.spm.baudas.web; -import java.io.IOException; -import java.io.PrintWriter; - import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; @@ -10,6 +7,8 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import java.io.IOException; +import java.io.PrintWriter; /** * Servlet implementation class LoginServlet. @@ -31,6 +30,7 @@ public class LoginServlet extends HttpServlet { */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + String password = request.getParameter("password"); if (this.password.equals(password)) { HttpSession newSession = request.getSession(true); newSession.setAttribute("authentication", true);