overall security cleanup and fixes

This commit is contained in:
eparaschiv 2013-06-02 20:08:13 +03:00
parent d28c7a14f8
commit 0eea508ede
6 changed files with 30 additions and 18 deletions

View File

@ -132,6 +132,15 @@
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>

View File

@ -7,7 +7,7 @@
</configSuffixes> </configSuffixes>
<enableImports><![CDATA[false]]></enableImports> <enableImports><![CDATA[false]]></enableImports>
<configs> <configs>
<config>src/main/webapp/WEB-INF/mvc-servlet.xml</config> <config>src/main/webapp/WEB-INF/api-servlet.xml</config>
</configs> </configs>
<configSets> <configSets>
</configSets> </configSets>

View File

@ -1,7 +1,6 @@
package org.baeldung.spring; package org.baeldung.spring;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
@ -9,8 +8,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView; import org.springframework.web.servlet.view.JstlView;
// @Configuration
@EnableWebMvc @EnableWebMvc
@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter { public class MvcConfig extends WebMvcConfigurerAdapter {
public MvcConfig() { public MvcConfig() {

View File

@ -1,22 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" <beans:beans xmlns="http://www.springframework.org/schema/security"
xsi:schemaLocation=" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/security http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"> http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
<http use-expressions="true"> <http use-expressions="true">
<intercept-url pattern="/login*" access="permitAll" /> <intercept-url pattern="/login*" access="permitAll" />
<intercept-url pattern="/**" access="isAuthenticated()" /> <intercept-url pattern="/**" access="isAuthenticated()" />
<form-login login-page='/login.html' login-processing-url="/perform_login" default-target-url="/homepage.html" authentication-failure-url="/login.html?error=true" <!-- <form-login login-page='/login.html' login-processing-url="/perform_login"
always-use-default-target="true" /> default-target-url="/homepage.html" authentication-failure-url="/login.html?error=true" -->
<!-- always-use-default-target="true" /> -->
</http> <http-basic />
<authentication-manager> </http>
<authentication-provider ref="customAuthenticationProvider" />
</authentication-manager> <authentication-manager>
<authentication-provider ref="customAuthenticationProvider" />
</authentication-manager>
</beans:beans> </beans:beans>

View File

@ -24,13 +24,13 @@
<!-- Spring child --> <!-- Spring child -->
<servlet> <servlet>
<servlet-name>mvc</servlet-name> <servlet-name>api</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>mvc</servlet-name> <servlet-name>api</servlet-name>
<url-pattern>/</url-pattern> <url-pattern>/api/*</url-pattern>
</servlet-mapping> </servlet-mapping>
<!-- Spring Security --> <!-- Spring Security -->