76得票8回答
Spring Security能在Spring控制器方法上使用@PreAuthorize吗?

Spring安全框架能否在Spring控制器方法上使用@PreAuthorize注解?

76得票5回答
Spring Security 5 替代 OAuth2RestTemplate 的解决方案

在 spring-security-oauth2:2.4.0.RELEASE 中,诸如 OAuth2RestTemplate、OAuth2ProtectedResourceDetails 和 ClientCredentialsAccessTokenProvider 等类都已被标记为过时。 从...

75得票5回答
使用基于Spring的SockJS / STOMP Web Socket的JSON Web Token(JWT)

背景 我正在使用Spring Boot(1.3.0.BUILD-SNAPSHOT)设置RESTful Web应用程序,其中包括STOMP / SockJS WebSocket。 我打算从iOS应用程序以及Web浏览器中使用WebSocket,我想使用JSON Web Tokens(JWT)来...

75得票11回答
如何使用Spring Security手动注销用户?

也许答案很简单:如何在Spring Security中手动注销当前登录的用户?只需要调用以下方法即可: SecurityContextHolder.getContext().getAuthentication().setAuthenticated(false); ?

75得票4回答
在Spring中,@EnableWebSecurity的作用是什么?

根据Spring文档: 将此注释添加到@Configuration类中,以便在任何WebSecurityConfigurer或更可能是通过扩展WebSecurityConfigurerAdapter基类并覆盖各个方法来定义Spring安全配置: 如此@EnableWebSecurity所示...

74得票3回答
antMatcher和mvcMatcher有什么区别?

在HttpSecurity中,antMatcher()和mvcMatcher()函数有什么区别? 请问什么情况下应该使用它们?

73得票3回答
Spring-Security中的默认AuthenticationManager是什么?它如何进行身份验证?

我有以下定义的bean:<sec:authentication-manager alias="authenticationManager"> <sec:authentication-provider user-service-ref="userDeta...

73得票3回答
禁用Spring Boot Web应用程序中的CSRF的原因是什么?

有许多教程展示了如何禁用csrf,csrf().disable() (以及其他可能性,如. properties 、. yml 等。)但是没有任何解释为什么要这样做? 所以我的问题是: 为什么要禁用它? 它是否提高了性能?

73得票9回答
如何在Spring Boot中启用HTTP响应缓存

我使用Spring Boot 1.0.2实现了一个REST服务器。我在防止Spring设置禁用HTTP缓存的HTTP头方面遇到了一些问题。 我的控制器如下:@Controller public class MyRestController { @RequestMapping(value...

73得票9回答
如何测试spring-security-oauth2资源服务器的安全性?

随着Spring Security 4的发布及其对测试的改进支持,我想更新我的当前Spring安全性oauth2资源服务器测试。目前,我有一个帮助类,它使用ResourceOwnerPasswordResourceDetails设置OAuth2RestTemplate,其中包含一个测试Clie...