Writing an authorization filter for my web app(JSF 2.0)

*爱你&永不变心* 提交于 2019-11-27 14:53:57

If you need to allow the access simply call the

// it will process request normally, means it will leave the control from Filter
chain.doFilter(request, response);

if you want to restrict user then call

//take some action
response.sendRedirect("URL to some page");//it will simply make user redirected 

Some Suggestion

  • Make it configurable using some sort of XML of properties file , your code seems hard to me, tomorrow there might be another page added so you need to re compile your Filter.

  • If allowed then Simply use Spring Security it has got nice features. Also you won't be re inventing the wheel

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