Show TOC Start of Content Area

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

Purpose

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, getLoggedInClientUserand forceLogoffClientUser to force a user authentication or a user logoff.

Accessing the User Management Service

The following source code allows you to access the user management service:

Source code example:

 

// All used classes of the user management service are contained in package

// com.sap.tc.webdynpro.services.sal.um.api

 

// Let applicationPart be a WDDeployableObjectPart that represents a

// deployable object part of type WDDeployableObjectPartType.APPLICATION.

 

// Example 1:

// Check application configuration if user login is required and

// force login if this is the case; use method

// checkAuthentication(WDDeployableObjectPart) for that. The class

// returns true if authentication was successful.

if  ( WDClientUser.checkAuthentication(applicationPart) ) {

    // do something

} else {

    // authentication was not successful, so continue with

    // the regular application

}

 

// Example 2:

// get the currently logged in user

IWDClientUser user = WDClientUser.getCurrentUser();

 

// check whether the current user is authenticated or anonymous

if ( user.isAnonymous() ) {

    // anonymous user

} else {

    // authenticated user

}

 

// read some user profile information

String name = user.getLastName();

String title = user.getTitle();

 

// get the com.sap.security.api.IUser; it is null in case user

// represents an anonymous user

IUser iUser = user.getSAPUser();

 

Note

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

  

  

 

 

End of Content Area