Add tests and adjust code for Sonar rules
[portal/ric-dashboard.git] / webapp-backend / src / main / java / org / oransc / ric / portal / dashboard / portalapi / PortalAuthenticationFilter.java
index 4b6de91..2337e3f 100644 (file)
@@ -72,7 +72,7 @@ import org.springframework.security.web.authentication.preauth.PreAuthenticatedA
  * created and EPService cookie is set.
  * </UL>
  * 
- * TODO: What about sessions? Will this be stateless?
+ * Open question: what about sessions? Will this be stateless?
  * 
  * This filter uses no annotations to avoid Spring's automatic registration,
  * which add this filter in the chain in the wrong order.
@@ -105,7 +105,7 @@ public class PortalAuthenticationFilter implements Filter {
                                if (in == null) {
                                        String msg = "Failed to find property file on classpath: " + pf;
                                        logger.error(msg);
-                                       throw new RuntimeException(msg);
+                                       throw new SecurityException(msg);
                                } else {
                                        try {
                                                in.close();
@@ -225,7 +225,7 @@ public class PortalAuthenticationFilter implements Filter {
                String redirectUrl = portalBaseUrl + "?" + PortalAuthenticationFilter.REDIRECT_URL_KEY + "=" + encodedAppUrl;
                String aHref = "<a href=\"" + redirectUrl + "\">";
                // If only Java had "here" documents.
-               String body = String.join(//
+               return String.join(//
                                System.getProperty("line.separator"), //
                                "<html>", //
                                "<head>", //
@@ -244,7 +244,6 @@ public class PortalAuthenticationFilter implements Filter {
                                "</p>", //
                                "</body>", //
                                "</html>");
-               return body;
        }
 
        /**