In Shiro Guice, how can I change authc to a different subclass?

南笙酒味 提交于 2019-12-25 04:59:15

问题


Example:

In shiro.ini I have:

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

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

authc=webapp.filters.VerboseFormAuthenticationFilter

回答1:


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


来源:https://stackoverflow.com/questions/10913745/in-shiro-guice-how-can-i-change-authc-to-a-different-subclass

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!