Skip to Content
Author's profile photo Katrin Welsch

Configure a log off button within your aBPM forms

Within forms generated by aBPM (task UIs as well as standalone applications) there is a possibility to configure a logout button in the known Fiori like design within the form header.

You can set the default logout button that comes with aBPM visible within the Java System Properties within the NetWeaver Administrator by setting “headerLogoutVisible” to “true” as shown below.

This setting is a global one and will be used for all aBPM forms running on the specific system.

When reloading an arbitrary aBPM form you should see the logout button on the upper right corner as shown in the screenshot below.

By clicking the button the default event “_ABPM_LOGOUT” is fired.

How the event is finally treated within the specific scenario can be handled within the handleUI callback method. By default the button has no functionality.

The code bellow shows how to catch the event

public ICallbackResult handleUIEvent(AbstractWrappedCallbackContext<Inbox> ctx, WDEvent event) {
		String eventName = event.getEventName();
		if ("_ABPM_LOGOUT".matches(eventName)) {
			// Here you can implement how to handle the event
			return findOptionById(ctx, eventName, InboxOptionEnum.LOGOUT, null);
		}
}

 

In our example an option defined within the aBPM config.xml file is returned. This definition is shown below.

The javascript option configured, triggers the location replacement to the URL opening a LogoutServlet. The Servlet is implemented as shown below:

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.sap.security.api.UMFactory;

public class LogoutServlet extends HttpServlet {
	
	private static final String relInboxLink = "..<relative URL to the page someone should be redirected when logged in again>";

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		UMFactory.getAuthenticator().forceLogoffUser(request, response, relInboxLink);
	}	
}

 

Here we first force a logoff of the current user via the API provided by the UME. This will lead the user to the following screen when clicking the button:

With the third parameter of the UME function one can define where the user is redirected to when logging in again via the provided button on the logoff screen above.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.