- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Spring Security 中 ROLE_ANONYMOUS 和 IS_AUTHENTICATED_ANONYMOUSLY 有什么区别。
换句话说,RoleVoter 和 AuthenticatedVoter 有何不同?
最佳答案
来自 spring security documentation 中的相关部分,
You will often see the ROLE_ANONYMOUS attribute in the above interceptor configuration replaced with IS_AUTHENTICATED_ANONYMOUSLY, which is effectively the same thing when defining access controls. This is an example of the use of the AuthenticatedVoter which we will see in the authorization chapter. It uses an AuthenticationTrustResolver to process this particular configuration attribute and grant access to anonymous users. The AuthenticatedVoter approach is more powerful, since it allows you to differentiate between anonymous, remember-me and fully-authenticated users. If you don't need this functionality though, then you can stick with ROLE_ANONYMOUS, which will be processed by Spring Security's standard RoleVoter.
The anonymous access issue is partly historical. Anonymous tokens were introduced initially (i.e. ROLE_ANONYMOUS) which would allow you to use a "secure-by-defaul" configurations with specific exceptions. At a later stage the AuthenticatedVoter was introduced to allow you to differentiate between different levels of authentication - anonyous, remember-me and fully-authenticated (i.e. logged in during the current session). I've added an extra bit to the anonymous chapter to explain that they are the same unless you require the extra functionality offered by the AuthenticatedVoter.
关于spring-security - Spring 安全 : difference between ROLE_ANONYMOUS and IS_AUTHENTICATED_ANONYMOUSLY,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5482552/
我在注册后使用以下方法进行程序化登录 private void autoLogin(User user, HttpServletRequest request) { G
我使用 Spring Security 2.x 已经有一段时间了,但最近我切换到了 3.x。我总是使用自己的 UserDetails 实现针对数据库的接口(interface)和身份验证。 一切正常(
在 Spring Security 中 ROLE_ANONYMOUS 和 IS_AUTHENTICATED_ANONYMOUSLY 有什么区别。 换句话说,RoleVoter 和 Authentica
在如下例的 Spring 拦截 url 配置中,ROLE_USER 和 ROLE_ANONYMOUS 有什么区别?
我是一名优秀的程序员,十分优秀!