diff --git a/spring-security-rest/.springBeans b/spring-security-rest/.springBeans
index 7623a7e888..d11fb034bd 100644
--- a/spring-security-rest/.springBeans
+++ b/spring-security-rest/.springBeans
@@ -7,7 +7,7 @@
- src/main/webapp/WEB-INF/mvc-servlet.xml
+ src/main/webapp/WEB-INF/api-servlet.xml
diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/config/ClientWebConfig.java b/spring-security-rest/src/main/java/org/baeldung/spring/config/ClientWebConfig.java
index d0c33bd135..1a87fd8a09 100644
--- a/spring-security-rest/src/main/java/org/baeldung/spring/config/ClientWebConfig.java
+++ b/spring-security-rest/src/main/java/org/baeldung/spring/config/ClientWebConfig.java
@@ -1,13 +1,8 @@
package org.baeldung.spring.config;
-import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
-import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
-import org.springframework.web.servlet.view.InternalResourceViewResolver;
-import org.springframework.web.servlet.view.JstlView;
@EnableWebMvc
@Configuration
@@ -19,24 +14,4 @@ public class ClientWebConfig extends WebMvcConfigurerAdapter {
// API
- @Override
- public void addViewControllers(final ViewControllerRegistry registry) {
- super.addViewControllers(registry);
-
- registry.addViewController("/anonymous.html");
-
- registry.addViewController("/login.html");
- registry.addViewController("/homepage.html");
- }
-
- @Bean
- public ViewResolver viewResolver() {
- final InternalResourceViewResolver bean = new InternalResourceViewResolver();
-
- bean.setViewClass(JstlView.class);
- bean.setPrefix("/WEB-INF/view/");
- bean.setSuffix(".jsp");
-
- return bean;
- }
}
\ No newline at end of file
diff --git a/spring-security-rest/src/main/java/org/baeldung/spring/security/RestAuthenticationEntryPoint.java b/spring-security-rest/src/main/java/org/baeldung/spring/security/RestAuthenticationEntryPoint.java
index 53f2a736e0..9e6f4da1e0 100644
--- a/spring-security-rest/src/main/java/org/baeldung/spring/security/RestAuthenticationEntryPoint.java
+++ b/spring-security-rest/src/main/java/org/baeldung/spring/security/RestAuthenticationEntryPoint.java
@@ -9,6 +9,9 @@ import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
+/**
+ * The Entry Point will not redirect to any sort of Login - it will return the 401
+ */
@Component
public final class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
@@ -16,4 +19,5 @@ public final class RestAuthenticationEntryPoint implements AuthenticationEntryPo
public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
}
+
}
\ No newline at end of file
diff --git a/spring-security-rest/src/main/resources/webSecurityConfig.xml b/spring-security-rest/src/main/resources/webSecurityConfig.xml
index b40b5390ba..a0aeae9e6a 100644
--- a/spring-security-rest/src/main/resources/webSecurityConfig.xml
+++ b/spring-security-rest/src/main/resources/webSecurityConfig.xml
@@ -7,8 +7,8 @@
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
-
-
+
+
diff --git a/spring-security-rest/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml
similarity index 100%
rename from spring-security-rest/src/main/webapp/WEB-INF/mvc-servlet.xml
rename to spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml
diff --git a/spring-security-rest/src/main/webapp/WEB-INF/view/anonymous.jsp b/spring-security-rest/src/main/webapp/WEB-INF/view/anonymous.jsp
deleted file mode 100644
index d4e9c0289b..0000000000
--- a/spring-security-rest/src/main/webapp/WEB-INF/view/anonymous.jsp
+++ /dev/null
@@ -1,10 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
-
-
-
-
- Anonymous page
-
- ">To Login
-
-
\ No newline at end of file
diff --git a/spring-security-rest/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-rest/src/main/webapp/WEB-INF/view/homepage.jsp
deleted file mode 100644
index 5504d2f134..0000000000
--- a/spring-security-rest/src/main/webapp/WEB-INF/view/homepage.jsp
+++ /dev/null
@@ -1,9 +0,0 @@
-<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
-
-
-
-
- This is the body of the sample view
- ">Logout
-
-
\ No newline at end of file
diff --git a/spring-security-rest/src/main/webapp/WEB-INF/view/login.jsp b/spring-security-rest/src/main/webapp/WEB-INF/view/login.jsp
deleted file mode 100644
index 013ceccb4e..0000000000
--- a/spring-security-rest/src/main/webapp/WEB-INF/view/login.jsp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
- Login
-
-
-
-
-
\ No newline at end of file
diff --git a/spring-security-rest/src/main/webapp/WEB-INF/web.xml b/spring-security-rest/src/main/webapp/WEB-INF/web.xml
index 3238896d4a..d7e554666d 100644
--- a/spring-security-rest/src/main/webapp/WEB-INF/web.xml
+++ b/spring-security-rest/src/main/webapp/WEB-INF/web.xml
@@ -24,13 +24,13 @@
- mvc
+ api
org.springframework.web.servlet.DispatcherServlet
1
- mvc
- /
+ api
+ /api/*