Skip to content

Commit 56c520a

Browse files
author
eugenp
committed
security work on custom project
1 parent e5e92b6 commit 56c520a

File tree

6 files changed

+53
-46
lines changed

6 files changed

+53
-46
lines changed

spring-security-custom/.springBeans

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</configSuffixes>
88
<enableImports><![CDATA[false]]></enableImports>
99
<configs>
10-
<config>src/main/webapp/WEB-INF/api-servlet.xml</config>
10+
<config>src/main/webapp/WEB-INF/mvc-servlet.xml</config>
1111
</configs>
1212
<configSets>
1313
</configSets>

spring-security-custom/src/main/java/org/baeldung/spring/MvcConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public MvcConfig() {
2323
public void addViewControllers(final ViewControllerRegistry registry) {
2424
super.addViewControllers(registry);
2525

26-
registry.addViewController("/login.html");
26+
// registry.addViewController("/login.html");
2727
registry.addViewController("/homepage.html");
2828
}
2929

spring-security-custom/src/main/webapp/WEB-INF/api-servlet.xml renamed to spring-security-custom/src/main/webapp/WEB-INF/mvc-servlet.xml

File renamed without changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
2+
<html>
3+
<head></head>
4+
5+
<body>
6+
<h1>This is the body of the sample view</h1>
7+
<a href="<c:url value="/perform_logout" />">Logout</a>
8+
</body>
9+
</html>

spring-security-custom/src/main/webapp/WEB-INF/web.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</context-param>
1616
<context-param>
1717
<param-name>contextConfigLocation</param-name>
18-
<param-value>org.baeldung.spring.config</param-value>
18+
<param-value>org.baeldung.spring</param-value>
1919
</context-param>
2020

2121
<listener>
@@ -24,13 +24,13 @@
2424

2525
<!-- Spring child -->
2626
<servlet>
27-
<servlet-name>api</servlet-name>
27+
<servlet-name>mvc</servlet-name>
2828
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
2929
<load-on-startup>1</load-on-startup>
3030
</servlet>
3131
<servlet-mapping>
32-
<servlet-name>api</servlet-name>
33-
<url-pattern>/api/*</url-pattern>
32+
<servlet-name>mvc</servlet-name>
33+
<url-pattern>/</url-pattern>
3434
</servlet-mapping>
3535

3636
<!-- Spring Security -->
Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,50 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
4-
xsi:schemaLocation="
2+
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
3+
xsi:schemaLocation="
54
http://java.sun.com/xml/ns/javaee
6-
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
7-
id="WebApp_ID" version="3.0">
5+
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
86

9-
<display-name>Spring MVC Application</display-name>
7+
<display-name>Spring MVC Application</display-name>
108

11-
<!-- Spring root -->
12-
<context-param>
13-
<param-name>contextClass</param-name>
14-
<param-value>
9+
<!-- Spring root -->
10+
<context-param>
11+
<param-name>contextClass</param-name>
12+
<param-value>
1513
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
1614
</param-value>
17-
</context-param>
18-
<context-param>
19-
<param-name>contextConfigLocation</param-name>
20-
<param-value>org.baeldung.spring.web.config</param-value>
21-
</context-param>
15+
</context-param>
16+
<context-param>
17+
<param-name>contextConfigLocation</param-name>
18+
<param-value>org.baeldung.spring</param-value>
19+
</context-param>
2220

23-
<listener>
24-
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
25-
</listener>
21+
<listener>
22+
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
23+
</listener>
2624

27-
<!-- Spring child -->
28-
<servlet>
29-
<servlet-name>mvc</servlet-name>
30-
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
31-
<load-on-startup>1</load-on-startup>
32-
</servlet>
33-
<servlet-mapping>
34-
<servlet-name>mvc</servlet-name>
35-
<url-pattern>/</url-pattern>
36-
</servlet-mapping>
25+
<!-- Spring child -->
26+
<servlet>
27+
<servlet-name>mvc</servlet-name>
28+
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
29+
<load-on-startup>1</load-on-startup>
30+
</servlet>
31+
<servlet-mapping>
32+
<servlet-name>mvc</servlet-name>
33+
<url-pattern>/</url-pattern>
34+
</servlet-mapping>
3735

38-
<!-- Spring Security -->
39-
<filter>
40-
<filter-name>springSecurityFilterChain</filter-name>
41-
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
42-
</filter>
43-
<filter-mapping>
44-
<filter-name>springSecurityFilterChain</filter-name>
45-
<url-pattern>/*</url-pattern>
46-
</filter-mapping>
36+
<!-- Spring Security -->
37+
<filter>
38+
<filter-name>springSecurityFilterChain</filter-name>
39+
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
40+
</filter>
41+
<filter-mapping>
42+
<filter-name>springSecurityFilterChain</filter-name>
43+
<url-pattern>/*</url-pattern>
44+
</filter-mapping>
4745

48-
<!-- <welcome-file-list> -->
49-
<!-- <welcome-file>index.html</welcome-file> -->
50-
<!-- </welcome-file-list> -->
46+
<!-- <welcome-file-list> -->
47+
<!-- <welcome-file>index.html</welcome-file> -->
48+
<!-- </welcome-file-list> -->
5149

5250
</web-app>

0 commit comments

Comments
 (0)