我正在尝试将ACL功能添加到我的服务器.我已经使用java文件配置了spring security,并希望以相同的方式添加ACL.我该怎么办?我发现的所有教程都使用了XML文件.
SecurityInit:
@Order(1) public class SecurityInitializer extends AbstractSecurityWebApplicationInitializer { }
SecurityConfig
@EnableWebMvcSecurity @EnableGlobalMethodSecurity(prePostEnabled=true) @Component @ComponentScan(basePackages = {"test.package"}) public class SecurityConfig extends WebSecurityConfigurerAdapter { ... @Autowired protected void registerAuthentication(UserDetailsService userDetailsService,AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService); } // http://stackoverflow.com/a/21100458/162345 @Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .headers().disable() .addFilterBefore(...) .addFilterBefore(...) // TODO: create a better way to differentiate login to signup .exceptionHandling() .authenticationEntryPoint(noRedirectForAnonymous) .and() .formLogin() .successHandler(restAuthenticationSuccessHandler) .failureHandler(restAuthenticationFailureHandler) .and() .logout() .logoutSuccessHandler(noRedirectlogoutSuccessHandler) .and() .authorizeRequests() .antMatchers("/api/keywords/**").permitAll() .antMatchers("/api/**").authenticated(); } }
没有xml文件就无法配置spring acl.这在春季文档本身中提到.请参阅spring文档.
原文链接:https://www.f2er.com/xml/293023.html