security work

This commit is contained in:
eugenp 2013-06-02 19:10:14 +03:00
parent a2e7741d75
commit e5e92b6ae0
8 changed files with 47 additions and 38 deletions

View File

@ -0,0 +1,40 @@
package org.baeldung.spring;
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
public class MvcConfig extends WebMvcConfigurerAdapter {
public MvcConfig() {
super();
}
// API
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
super.addViewControllers(registry);
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;
}
}

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.config;
package org.baeldung.spring;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

View File

@ -1,17 +0,0 @@
package org.baeldung.spring.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@EnableWebMvc
@Configuration
public class ClientWebConfig extends WebMvcConfigurerAdapter {
public ClientWebConfig() {
super();
}
// API
}

View File

@ -1,14 +0,0 @@
package org.baeldung.spring.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan("org.baeldung.web")
public class WebConfig {
public WebConfig() {
super();
}
}

View File

@ -17,7 +17,7 @@
<beans:bean id="mySuccessHandler" class="org.baeldung.security.MySavedRequestAwareAuthenticationSuccessHandler" />
<authentication-manager alias="authenticationManager">
<authentication-manager>
<authentication-provider ref="customAuthenticationProvider" />
</authentication-manager>

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.security;
package org.baeldung.security;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.web.config;
package org.baeldung.spring;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -11,9 +11,9 @@ import org.springframework.web.servlet.view.JstlView;
@EnableWebMvc
@Configuration
public class ClientWebConfig extends WebMvcConfigurerAdapter {
public class MvcConfig extends WebMvcConfigurerAdapter {
public ClientWebConfig() {
public MvcConfig() {
super();
}

View File

@ -1,4 +1,4 @@
package org.baeldung.spring.web.config;
package org.baeldung.spring;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;