Getting the Current User 
Before you check for authorizations, you must ensure that you have the current user. Getting the current user is also useful for personalizing an application.
You have protected your application by requiring authentication.
Use the method appropriate to your application.
The IAuthentication interface of the user management engine (UME) API provides the getLoggedInUser() method.
The WDClientUser interface of the Web Dynpro API provides the getClientUser() method.
Syntax
IUser user = UMFactory.getAuthenticator().getLoggedInUser(request, response);
SAP Help Portal: http://help.sap.com/javadocs