cancel
Showing results for 
Search instead for 
Did you mean: 

Using UME API's in SAML Mapping module

Former Member
0 Kudos

Hi,

Please help me with using UME API's in SAML Mapping module.

I'm developing a SAML Mapping module where I recieve an email id of the user in nameidentifier.

But in UME the user is not email so I want to use the UME API to search the User Name using the email I recieve from SAML assertion.

If I use the UMFactory.getInstance() or any other method, I get the following error,

An error occurred in the MyMappingModule:

The MyMappingModule exception while accesing UME: Could not initialize UMFactory! Please set property 'ume.cfg.path' or call UMFactory.initialize() first" - in the mapping module.

Please let me know how to get rid of this error.

I've started the UME services in Visual Administrator but still the same result.

Thanks in advance.

Best Regards,

Ritin

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

See if below code snippet help you.

public String retrieveUserId(String email) throws Exception {
			try {
				IUserFactory userFactory = UMFactory.getUserFactory();
				IUserSearchFilter searchFilter = userFactory.getUserSearchFilter();
				searchFilter.setEmail(
					email,
					ISearchAttribute.EQUALS_OPERATOR,
					false);
				ISearchResult searchResult = userFactory.searchUsers(searchFilter);
				if (searchResult.hasNext()) {
					String uniqueid = (String) searchResult.next();
					IUser user = userFactory.getUser(uniqueid);
					return user.getName();
				} else {
					LOCATION.errorT(
						"no user with e-mail: " + email + "was found in UME");
					throw new Exception(
						"no user with e-mail: " + email + "was found in UME");
				}
			} catch (Exception e) {
				LOCATION.errorT(
					"error in retreiving SAP user ID for e-mail: "
						+ email
						+ ". Error:"
						+ e);
				throw new Exception(
					"error in retreiving SAP user ID for e-mail: "
						+ email
						+ ". Error:"
						+ e);
			}
		}

0 Kudos

Hi,

Problem is to get the UMFactory instance from the login module context. As the login module does not

run in J2EE containers, the UMFactory instance is not available to an external app.

It is this reason that I have deployed an ejb that does the what you have mentioned in your code and

returns the found user.

But from my login module I do not get any reply from this ejb.

And I do not get any exceptions in any of the log files on portal server.

If I use the same ejb in another portal application, the ejb replies with correct user search find.

regards,

Ajeet Phadnis

0 Kudos

Hello,

I am working on exactly the same application. In my SAML Mapping module, I get user UniquID that matches with

portal user's uniqueID. This data is received from SAML assertion's nameidentifier attribute.

My goal is to take this id and search the UME repository and if the user is found, then issue the logon token to the user.

After some investigations I found that the UMFactory object is not available for an application that is not running in

one of the J2EE engines containers. It was hard for me to belive that JASS login stack is not part of the J2EE containers.

However, then I created a portal service to get hold of the UMFactory and I found that portal service was not a solution as well.

So, I tried to build a simple sessionless ejb and its business method would search for a given uniqueid in portal using UMFactory.

The ejb test client was build using abstract portal component's doContent method.

And it worked.

So, I take this client code into my SAML mapping module's helper class method, and when I try to get the results, I find that

the ejb create method fails. Now I am stuck.

how can I resolve this

Ajeet Phadnis

MichaelShea
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Ritin,

This is written for 7.1, but the examples should still work for 7.0.

http://help.sap.com/saphelp_nwce72/helpdata/en/9f/10553e1e75424d8610643d060ce8aa/frameset.htm

Then follow the example for Searching for Users with Standard Search.

-Michael