如何配置没有XML文件的Spring ACL

编程入门 行业动态 更新时间:2024-10-10 08:18:45
本文介绍了如何配置没有XML文件的Spring ACL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在为我的伺服器新增ACL功能。我已配置spring安全使用java文件,并希望以相同的方式添加ACL。我该怎么办呢?所有的教程我发现使用XML文件。

I am trying to add ACL capabilities to my server. I have configured spring security using java file and would like to add ACL in the same manner. How should I do it? All the tutorials I found used XML file.

SecurityInit:

@Order(1) public class SecurityInitializer extends AbstractSecurityWebApplicationInitializer { }

SecurityConfig

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); } // stackoverflow/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(); } }

推荐答案

是没有办法配置spring acl没有xml文件。这在spring文档本身提到。请参阅spring文档。

There is no way to configure spring acl without xml file. This is mentioned in spring docs itself.Refer to spring documentation.

更多推荐

如何配置没有XML文件的Spring ACL

本文发布于:2023-11-28 10:52:37,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   XML   ACL   Spring

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!