【问题标题】:How to perform anonymous authentication?如何进行匿名认证?
【发布时间】:2011-12-17 07:01:16
【问题描述】:

我一直以为acegi security和spring security 3.0是一样的……但是好像错了。

很遗憾,我找不到任何 acegi 安全文档。

我需要为安全上下文分配一个具有特殊角色的匿名用户,我发现这是this

但是 ACEGI 中没有 AnonymousAuthenticationFilter - 只有 AnonymousProcessingFilter。但是我应该怎么称呼它的id呢?

我试过这段代码:

<bean id="anonymousAuthFilter"
      class="net.sf.acegisecurity.providers.anonymous.AnonymousProcessingFilter">
    <property name="key" value="foobar"/>
    <property name="userAttribute" value="anonymousUser,ROLE_ANONYMOUS"/>
</bean>

<bean id="anonymousAuthenticationProvider"
      class="net.sf.acegisecurity.providers.anonymous.AnonymousAuthenticationProvider">
    <property name="key" value="foobar"/>
</bean>

但是在我实际登录之前,我的安全上下文中什么也没有。这很糟糕=(

有什么想法吗?

【问题讨论】:

标签: spring authentication spring-security


【解决方案1】:

acegi security是spring security的旧称。 (2.0以上的我不记得了,很久以前了)

我强烈推荐使用 Spring Security 3.0。注意:在 Spring Security 3.0 和 Spring Security 2.0 之间,包名和 Jar 结构发生了变化。

因此,如果您有当前文档,则需要将其翻译回 2.0。这个博客Spring Security 3.0.0.M1 Released 描述了这些变化。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-10-22
    • 2021-04-28
    • 2021-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多