security cleanup

This commit is contained in:
Eugen 2013-05-27 18:45:19 +03:00
parent 6ffd867e11
commit af424e266b
8 changed files with 59 additions and 59 deletions

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.web.config; package org.baeldung.spring.config;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -13,27 +13,27 @@ import org.springframework.web.servlet.view.JstlView;
@Configuration @Configuration
public class FrontendConfig extends WebMvcConfigurerAdapter { public class FrontendConfig extends WebMvcConfigurerAdapter {
public FrontendConfig() { public FrontendConfig() {
super(); super();
} }
// API // API
@Override @Override
public void addViewControllers(final ViewControllerRegistry registry) { public void addViewControllers(final ViewControllerRegistry registry) {
super.addViewControllers(registry); super.addViewControllers(registry);
registry.addViewController("/homepage.html"); registry.addViewController("/homepage.html");
} }
@Bean @Bean
public ViewResolver viewResolver() { public ViewResolver viewResolver() {
final InternalResourceViewResolver bean = new InternalResourceViewResolver(); final InternalResourceViewResolver bean = new InternalResourceViewResolver();
bean.setViewClass(JstlView.class); bean.setViewClass(JstlView.class);
bean.setPrefix("/WEB-INF/view/"); bean.setPrefix("/WEB-INF/view/");
bean.setSuffix(".jsp"); bean.setSuffix(".jsp");
return bean; return bean;
} }
} }

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.web.config; package org.baeldung.spring.config;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource; import org.springframework.context.annotation.ImportResource;
@ -7,8 +7,8 @@ import org.springframework.context.annotation.ImportResource;
@ImportResource({ "classpath:webSecurityConfig.xml" }) @ImportResource({ "classpath:webSecurityConfig.xml" })
public class SecSecurityConfig { public class SecSecurityConfig {
public SecSecurityConfig() { public SecSecurityConfig() {
super(); super();
} }
} }

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.web.config; package org.baeldung.spring.config;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -8,10 +8,10 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@ComponentScan("org.baeldung.spring.web.controller") @ComponentScan("org.baeldung.spring.web.controller")
public class WebConfig extends WebMvcConfigurerAdapter { public class WebConfig extends WebMvcConfigurerAdapter {
public WebConfig() { public WebConfig() {
super(); super();
} }
// API // API
} }

View File

@ -1,28 +0,0 @@
package org.baeldung.spring.web.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class TestController {
public TestController() {
super();
}
// API
@RequestMapping("/permitAll")
@ResponseBody
public String permitAll() {
return "Permit All";
}
@RequestMapping("/securityNone")
@ResponseBody
public String securityNone() {
return "Security None";
}
}

View File

@ -1,8 +1,8 @@
package org.baeldung.spring.web.controller; package org.baeldung.web.controller;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.baeldung.spring.web.Foo; import org.baeldung.web.dto.Foo;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -0,0 +1,28 @@
package org.baeldung.web.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class TestController {
public TestController() {
super();
}
// API
@RequestMapping("/permitAll")
@ResponseBody
public String permitAll() {
return "Permit All";
}
@RequestMapping("/securityNone")
@ResponseBody
public String securityNone() {
return "Security None";
}
}

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.web; package org.baeldung.web.dto;
import java.io.Serializable; import java.io.Serializable;

View File

@ -21,7 +21,7 @@
<authentication-provider> <authentication-provider>
<user-service> <user-service>
<user name="temporary" password="temporary" authorities="ROLE_ADMIN" /> <user name="temporary" password="temporary" authorities="ROLE_ADMIN" />
<user name="user" password="user" authorities="ROLE_USER" /> <user name="user" password="userPass" authorities="ROLE_USER" />
</user-service> </user-service>
</authentication-provider> </authentication-provider>
</authentication-manager> </authentication-manager>