在Shiro Guice中,如何将authc更改为其他子类?

时间:2012-06-06 11:56:59

标签: guice shiro

示例:

在shiro.ini中我有:

# Change from FormAuthenticationFilter to VerboseFormAuthenticationFilter
authc=webapp.filters.VerboseFormAuthenticationFilter
authc.loginUrl=/login
authc.successUrl=/oncall

如何使用Shiro Guice执行上述操作?我对以下内容感兴趣:

authc=webapp.filters.VerboseFormAuthenticationFilter

1 个答案:

答案 0 :(得分:0)

public class YourShiroSecurityModule extends ShiroWebModule {
    private static final Key<VerboseFormAuthenticationFilter> VERBOSE_AUTH = Key.get(VerboseFormAuthenticationFilter.class);

    public YourShiroSecurityModule(ServletContext servletContext) {
        super(servletContext);
    }

    @Override
    protected void configureShiroWeb() {
        [...]
        addFilterChain("<path>", VERBOSE_AUTH);
    }
}