User Mapping 
User
mapping is a feature that has been introduced to SAP products with EP 5.0.
This feature provides log on information for users on third party systems. The
log on information can simply be user ID and password and additionally
information like NT-Domain and language.
In EP
5.0, user mapping is available as a personalization feature for every end user
and as an administration feature that allows administrators to map users,
groups or roles to specific accounts. In a productive environment, the user
mapping feature contains a user interface to administer the data. In the
SAP Enterprise Portal, the user interface calls the system
landscape service to get a list of all systems that apply for user mapping.
The system landscape has an user mapping attribute that has to be set
accordingly.
The
UME for EP 6.0 offers two interfaces
to access the user mapping data:
·
IUserMappingService
·
IUserMappingData
Example:
import java.util.HashMap;
import java.util.Map;
import com.sap.security.api.IUser;
import com.sap.security.api.umap.IUserMappingData;
import com.sap.security.api.umap.NoLogonDataAvailableException;
import com.sapportals.portal.prt.component.AbstractPortalComponent;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
import com.sapportals.portal.prt.runtime.PortalRuntime;
import com.sapportals.portal.prt.service.usermapping.IUserMappingService;
public class UserMapping extends AbstractPortalComponent
{
public void doContent(IPortalComponentRequest request,
IPortalComponentResponse response)
{
// obtain system
String systemalias = "system";
// get user from request
IUser iuser = request.getUser ();
// get usermapping service
IUserMappingService iums = (IUserMappingService)
PortalRuntime.getRuntimeResources().getService(IUserMappingService.KEY);
IUserMappingData iumd = iums.getMappingData (systemalias, iuser);
Map map = new HashMap ();
try {
iumd.enrich (map);
}
catch (NoLogonDataAvailableException nldae) {
// Error handling
}
// In m is all data
String userid = (String)map.get( "user" );
String pwd = (String)map.get ("mappedpassword");
response.write("hallo" + userid);
response.write(" " + pwd);
}
}
|