Show TOC Start of Content Area

Background documentation User Management Service  Locate the document in its SAP Library structure

The user management services can be used to authenticate or check the authorizations of Web Dynpro application users.

The service also provides the user profile for the authenticated user. The IWDClientUser interface provides methods that enables you to access the user profile. This means that you can read user attributes such as user name, user title, or user address. The WDClientUser interface provides the getCurrentUser method, which allows access to the user of the current request.

In addition, the IWDClientUser interface provides methods that enables you to check the user authorizations for a Web Dynpro application.

For example, the checkAuthentication method checks whether or not the authentication of the user is required for a specific Web Dynpro application. A user authentication is required when the configuration property Authentication of the application configuration has the value true. If the value is set to true, the checkAuthentication method calls the logon page for the authentication. The forceLoggedInClientUser method is used internally for this call.

The IWDClientUser interface provides the methods forceLoggedInClientUser, getLoggedInClientUser and forceLogoffClientUser to force a user authentication or a user logoff.

Accessing the User Management Service

The following source code shows some options to handle users:

//check whether the current user is authenticated or anonymous

IWDClientUser wdUser = WDClientUser.getLoggedInClientUser();

 

//get user of the current session

try {

   IWDClientUser wdUser1 = WDClientUser.getCurrentUser();

} catch (WDUMException e) {

   mmger.reportException(e.getMessage());

}

 

// get com.sap.security.api.IUser, his locale and corresponding information

try {

   IUser currentUser = WDClientUser.getCurrentUser().getSAPUser();

   Locale userLocale = currentUser.getLocale();

   String language = userLocale.getLanguage();

} catch (WDUMException e1) {

   mmger.reportException(e1.getMessage());

}

Note

By default, a user authentication is not required for a Web Dynpro application. However, if you assign the value true to the authentication property of the application configuration, the Web Dynpro application expects user authentication.

End of Content Area