In NetWeaver Portal it is possible to Import / Export roles. I want to create a custom tool which have the same behavior. How I can achieve this using JAVA code? I couldn't find any Classes or Interfaces to do this in UME API.
Note: The custom tool have many other functionalities and act as a centralized portal for all the JAVA systems.
Utilize SAP Composition Environment set of APIs, particularly Security API
The
com.sap.security.apinamespace containsIUserAccountFactoryfactory has getUserAccount(s) method which returns IUserAccount object (array of objects). It has getRoles method which perfectly meets your needs.Together with addToRole method you can implement export/import of roles.
You can try to serialize roles of specific user with this sample: