Skip to Content

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

You can set the default log off 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 implemented 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
        // This shows our exemplary option
		return findOptionById(ctx, eventName, InboxOptionEnum.LOGOUT, null);
	}
}

In our example an option defined within the aBPM config.xml file is returned via the “findOptionById” function provided by aBPM. This definition within the config.xml is shown below.

The JavaScript option configured triggers the location replacement to the URL calling  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 {
	
    // relative URL defining where the user is redirected if he logs ins again
	private static final String relInboxLink = "../abpmui5/create/index.html?boTechnicalName=bo://com.test.inbox.bo/Inbox&companyCode=100&processMode=CREATE&processState=START";

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

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
        // UME API used for log off an handling of redirection
		UMFactory.getAuthenticator().forceLogoffUser(request, response, relInboxLink);
	}	
}

Here we first force a logoff of the current user via the API provided by the UME. After that the API function redirects to a logoff page which acknowledges that a logoff has taken place. Next to that the logoff page contains a button to log on again which points to the URL defined as the third parameter of the function call.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply