User can still view scrollable page after exiting grails

In my grails project, I am using spring security kernel plugin. I provided a logout link as

<g:link controller="logout">Logout</g:link> in my gsp pages. 

Code in LogoutController as:

 class LogoutController { /** * Index action. Redirects to the Spring security logout uri. */ def index = { // TODO put any pre-logout code here session.invalidate() redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl // '/j_spring_security_logout' } } 

When a user clicks on him, he redirects the user to the login page. But if the user clicks the back button, the user can see the previous work page. I do not want to redirect it to the previous page, and it should remain on the login page. What can I do for this?

Additional Information: I created one tag library that validates the login name. If it is anonymous, it is redirected to the login page or sends it to the home page. But working on this, the user must click on something. Since at present, after logging out, the user can see the previous page by clicking the "Back" button. I do not want to redirect it to the previous page. It should remain on the login page.

+4
source share
1 answer

Simple, just put this code in all of your pages:

 <% response.setHeader("Cache-Control","no-cache"); response.setHeader("Cache-Control","no-store"); response.setDateHeader("Expires", 0); response.setHeader("Pragma","no-cache"); %> 
+7
source

Source: https://habr.com/ru/post/1446438/


All Articles