WebSphere Application Server: Implement different Logout technique

Implementing Logout functionality in a form based authentication in J2EE website is straight forward. The session needs to be invalidated by calling request.getSession().invalidate() method. Thus in a simple servlet following code will be the code for logout:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.getSession().invalidate(); response.sendRedirect("/sampleapplication/index.jsp"); }
Code language: Java (java)
This is simple way for implementing logout. There is also another, easier, way to logout the user when using WebSphere Application Server. All you have to do is have a form which gets submit to action ibm_security_logout.
<form method="post" action="ibm_security_logout" name="logoutForm"> <input type="hidden" name="logoutExitPage" VALUE="/sampleapplication/index.jsp" > Click here to logout: <input type="submit" name="logout" value="Logout"> </form>
Code language: HTML, XML (xml)
In the above example, the hidden field “logoutExitPage” is contains the value of the page where the application redirects after logout.

View Comments

  • I used the servlet code for LogOut utility. After logging our I am redirecting the browser to Log-in page. And on login page when user clicks on the back button, my application goes to the previous page from where user has executed logout.

    Kindly help.

    Thank you.

Share
Published by
Viral Patel
Tags: How-To ibm_security_logout logout technique waslite websphere

Recent Posts

  • Java

Java URL Encoder/Decoder Example

Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…

5 years ago
  • General

How to Show Multiple Examples in OpenAPI Spec

Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…

5 years ago
  • General

How to Run Local WordPress using Docker

Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…

5 years ago
  • Java

Create and Validate JWT Token in Java using JJWT

1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…

5 years ago
  • Spring Boot

Spring Boot GraphQL Subscription Realtime API

GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…

5 years ago
  • Spring Boot

Spring Boot DynamoDB Integration Test using Testcontainers

1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…

5 years ago