在Shiro Guice中,如何将authc更改为其他子类? [英] In Shiro Guice, how can I change authc to a different subclass?

查看:232
本文介绍了在Shiro Guice中,如何将authc更改为其他子类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例:

在shiro.ini中,我有:

In shiro.ini I have:

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

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

How can I perform the above using Shiro Guice? I'm interested in the following line:

authc=webapp.filters.VerboseFormAuthenticationFilter

推荐答案

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);
    }
}

这篇关于在Shiro Guice中,如何将authc更改为其他子类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆