我在项目中使用shiro进行身份验证
以下是代码
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
<property name="securityManager" ref="securityManager" />
<property name="filterChainDefinitions">
<value>
[main]
authc.loginUrl = /login.jsp
authc.successUrl = /dashboard
authc.failureKeyAttribute = shiroLoginFailure
[roles]
ROLE_ADMIN = *
[urls]
/static/** = anon
/** = authc
</value>
</property>
</bean>
现在shiro所做的是在身份验证成功之后它将用户引导到同一应用程序中存在的URL ...我想将它指向其他一些Web应用程序说www.facebook.com ...任何人都可以告诉我怎么了?
答案 0 :(得分:0)
你能做的就是让它落在一个重定向的servlet上
public class RedirectServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.sendRedirect("http://www.facebook.com");
}
}
将其映射到成功页面:
<servlet>
<servlet-name>RedirectServlet</servlet-name>
<servlet-class>packagename...RedirectServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RedirectServlet</servlet-name>
<url-pattern>/dashboard</url-pattern>
</servlet-mapping>