草庐IT

security-howto

全部标签

java - Spring Security、尾部斜杠和 URL 中的点

我使用SpringSecurity3.1.4来保护部署到Tomcat的SpringMVC3.2.4应用程序。我有以下SpringSecurity配置:我注意到不带斜杠的URL模式(例如,/about)与带有斜杠的URL(例如,/about/)不匹配,反之亦然反之亦然。换句话说,带有斜线的URL和不带斜线的相同URL被SpringSecurity视为两个不同的URL。该问题可以通过使用两个安全规则来解决:有没有更好的解决方案?我知道path-type="regex"允许使用正则表达式定义URL模式,但如果可能的话,我想避免任何不必要的复杂性。更新正如AdamGent所指出的,还有一个涉及

java - Spring Security、尾部斜杠和 URL 中的点

我使用SpringSecurity3.1.4来保护部署到Tomcat的SpringMVC3.2.4应用程序。我有以下SpringSecurity配置:我注意到不带斜杠的URL模式(例如,/about)与带有斜杠的URL(例如,/about/)不匹配,反之亦然反之亦然。换句话说,带有斜线的URL和不带斜线的相同URL被SpringSecurity视为两个不同的URL。该问题可以通过使用两个安全规则来解决:有没有更好的解决方案?我知道path-type="regex"允许使用正则表达式定义URL模式,但如果可能的话,我想避免任何不必要的复杂性。更新正如AdamGent所指出的,还有一个涉及

java - Spring security - 禁用注销重定向

我正在使用带有REST的SpringSecurity,并且我正在使用URL(/logout)作为我的注销方法的端点。但是调用这个方法后,它把我重定向到(/login?logout),我知道这是springlogOutSuccessUrl。我想摆脱重定向。这是我的代码:protectedvoidconfigure(HttpSecurityhttp)throwsException{http.authorizeRequests().antMatchers("/login").permitAll().anyRequest().fullyAuthenticated().and().require

java - Spring security - 禁用注销重定向

我正在使用带有REST的SpringSecurity,并且我正在使用URL(/logout)作为我的注销方法的端点。但是调用这个方法后,它把我重定向到(/login?logout),我知道这是springlogOutSuccessUrl。我想摆脱重定向。这是我的代码:protectedvoidconfigure(HttpSecurityhttp)throwsException{http.authorizeRequests().antMatchers("/login").permitAll().anyRequest().fullyAuthenticated().and().require

security - 我应该如何保护使用 Wicket、Spring 和 JPA 编写的 web 应用程序?

所以,我有一个使用Wicket1.4框架的基于Web的应用程序,它使用Springbeans、JavaPersistenceAPI(JPA)和OpenSessionInView模式。我希望找到一个声明性的安全模型,但不需要大量的XML配置——我更喜欢注释。以下是目前的选项:SpringSecurity(guide)-看起来很完整,但我发现的每个将它与Wicket结合的指南仍​​然称它为AcegiSecurity,这让我觉得它一定是旧的。Wicket-Auth-Roles(guide1和guide2)-大多数指南建议将其与SpringSecurity混合使用,我喜欢@Authorize(

security - 我应该如何保护使用 Wicket、Spring 和 JPA 编写的 web 应用程序?

所以,我有一个使用Wicket1.4框架的基于Web的应用程序,它使用Springbeans、JavaPersistenceAPI(JPA)和OpenSessionInView模式。我希望找到一个声明性的安全模型,但不需要大量的XML配置——我更喜欢注释。以下是目前的选项:SpringSecurity(guide)-看起来很完整,但我发现的每个将它与Wicket结合的指南仍​​然称它为AcegiSecurity,这让我觉得它一定是旧的。Wicket-Auth-Roles(guide1和guide2)-大多数指南建议将其与SpringSecurity混合使用,我喜欢@Authorize(

spring - 如何使用 Spring Security 很好地处理文件上传 MaxUploadSizeExceededException

我正在使用SpringWeb4.0.5、SpringSecurity3.2.4、CommonsFileUpload1.3.1、Tomcat7,我得到了一个丑陋的MaxUploadSizeExceededException当我的上传大小超出限制时,会导致“500内部服务器错误”。我用一个很好的通用弹出窗口来处理它,但我宁愿让我的Controller通过正确的解释消息返回原始表单来处理它。我已经多次看到类似的问题,其中一些解决方案在不使用SpringSecurity时可能会起作用;我试过的没有一个对我有用。问题可能是在使用SpringSecurity时,CommonsMultipartRe

spring - 如何使用 Spring Security 很好地处理文件上传 MaxUploadSizeExceededException

我正在使用SpringWeb4.0.5、SpringSecurity3.2.4、CommonsFileUpload1.3.1、Tomcat7,我得到了一个丑陋的MaxUploadSizeExceededException当我的上传大小超出限制时,会导致“500内部服务器错误”。我用一个很好的通用弹出窗口来处理它,但我宁愿让我的Controller通过正确的解释消息返回原始表单来处理它。我已经多次看到类似的问题,其中一些解决方案在不使用SpringSecurity时可能会起作用;我试过的没有一个对我有用。问题可能是在使用SpringSecurity时,CommonsMultipartRe

java - 如何仅在安全端点上应用 Spring Security 过滤器?

我有以下SpringSecurity配置:httpSecurity.csrf().disable().exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().authorizeRequests().antMatchers("/api/**").fullyAuthenticated().and().addFilterBefore(authen

java - 如何仅在安全端点上应用 Spring Security 过滤器?

我有以下SpringSecurity配置:httpSecurity.csrf().disable().exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().authorizeRequests().antMatchers("/api/**").fullyAuthenticated().and().addFilterBefore(authen