Sign in users via Facebook and sign up new users automatically
[examples/facebook-app] / src / main / java / de / juplo / yourshouter / WebMvcConfig.java
1 package de.juplo.yourshouter;
2
3
4
5 import javax.inject.Inject;
6
7 import org.springframework.context.annotation.Configuration;
8 import org.springframework.social.connect.UsersConnectionRepository;
9 import org.springframework.web.servlet.config.annotation.EnableWebMvc;
10 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
11 import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
12 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
13
14
15 /**
16  * Spring MVC Configuration.
17  *
18  * @author Kai Moritz
19  */
20 @Configuration
21 @EnableWebMvc
22 public class WebMvcConfig extends WebMvcConfigurerAdapter
23 {
24   @Inject
25   private UsersConnectionRepository usersConnectionRepository;
26
27
28   /**
29    * Configure the {@link UserCookieInterceptor} to intercept all requests.
30    *
31    * @param registry
32    *     The {@link InterceptorRegistry} to use.
33    *
34    * @see {@link UserCookieInterceptor}
35    */
36   @Override
37   public void addInterceptors(InterceptorRegistry registry)
38   {
39     registry.addInterceptor(new UserCookieInterceptor(usersConnectionRepository));
40   }
41
42   /**
43    * {@inheritDoc}
44    */
45   @Override
46   public void addViewControllers(ViewControllerRegistry registry)
47   {
48     // Configure the view /thymeleaf/signin.html for the path /signin.html
49     registry.addViewController("/signin.html");
50   }
51 }