|
5 | 5 | */
|
6 | 6 | package org.sipxcom.sipxconfig.provision;
|
7 | 7 |
|
8 |
| -import javax.servlet.ServletContext; |
| 8 | +import org.sipfoundry.commons.security.SipXWebSecurityConfigurerAdapter; |
9 | 9 |
|
10 |
| -import org.springframework.beans.factory.annotation.Autowired; |
11 |
| -import org.springframework.context.ApplicationContext; |
12 | 10 | import org.springframework.context.annotation.Configuration;
|
13 |
| -import org.springframework.security.authentication.ProviderManager; |
14 |
| -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; |
15 |
| -import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
16 |
| -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
| 11 | + |
17 | 12 | import org.springframework.security.config.annotation.web.servlet.configuration.EnableWebMvcSecurity;
|
18 |
| -import org.springframework.web.context.support.WebApplicationContextUtils; |
| 13 | + |
19 | 14 |
|
20 | 15 | @Configuration
|
21 | 16 | @EnableWebMvcSecurity
|
22 |
| -public class SecurityConfig extends WebSecurityConfigurerAdapter { |
23 |
| - |
24 |
| - @Autowired |
25 |
| - private MongoUserDetailsService userDetailsService; |
26 |
| - |
27 |
| - @Autowired |
28 |
| - private ServletContext context; |
29 |
| - |
30 |
| - private static String SIPXCONFIG_PATH = "/sipxconfig"; |
31 |
| - |
32 |
| - private static String AUTHENTICATION_MANAGER = "authenticationManager"; |
33 |
| - |
34 |
| - @Override |
35 |
| - protected void configure(HttpSecurity http) throws Exception { |
36 |
| - http |
37 |
| - .csrf().disable() |
38 |
| - .authorizeRequests() |
39 |
| - .anyRequest().authenticated() |
40 |
| - .and() |
41 |
| - .httpBasic(); |
42 |
| - } |
43 |
| - |
44 |
| - @Autowired |
45 |
| - public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { |
46 |
| - ServletContext sipxconfigCtx = context.getContext(SIPXCONFIG_PATH); |
47 |
| - ApplicationContext webContext = WebApplicationContextUtils |
48 |
| - .getRequiredWebApplicationContext(sipxconfigCtx); |
49 |
| - ProviderManager authManager = (ProviderManager) webContext.getBean(AUTHENTICATION_MANAGER); |
50 |
| - auth.parentAuthenticationManager(authManager); |
51 |
| - //auth.userDetailsService(userDetailsService); |
52 |
| - } |
| 17 | +public class SecurityConfig extends SipXWebSecurityConfigurerAdapter { |
| 18 | + |
53 | 19 | }
|
0 commit comments