jsf - Prevent user going to pages through address bar -


i have web application. after user login, want user navigate pages clicking on buttons or links instead of manually changing url on browser address bar. saw few posts can use security constraint so. have in web.xml. seems not work.

<servlet>     <servlet-name>faces servlet</servlet-name>     <servlet-class>javax.faces.webapp.facesservlet</servlet-class>     <load-on-startup>1</load-on-startup> </servlet>  <servlet-mapping>     <servlet-name>faces servlet</servlet-name>     <url-pattern>/faces/*</url-pattern> </servlet-mapping>  <security-constraint>     <display-name>restrict raw xhtml documents</display-name>     <web-resource-collection>         <web-resource-name>xhtml</web-resource-name>         <url-pattern>/faces/*</url-pattern>     </web-resource-collection>     <auth-constraint /> </security-constraint> 

i not approach. there few things user expect when using web application , best user experience should not try , change way, users use browser.

however, if want this, 1 of following done:

  • you instrument of links , intercept click javascript. when clicked, interceptor should create cookie contains path link referring to. when user requests page, should check if cookie contains requested url, otherwise redirect them homepage.

  • you generate token each url, , append end of url, http://blabla.com/mypage become http://blabla.com/mypage?token=298347287. token incorporate information url , have timeout, after no longer valid. check validity of token, verify user indeed clicked on link, not entered url (note: still happen user enters url containing token copying link).


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -