cancel
Showing results for 
Search instead for 
Did you mean: 

How to get IPrincipal from IUser

Former Member
0 Kudos

Hi,

I wanted to know how to get a reference to an IPrincipal if I have the reference to IUser interface.

Basically I have IResourceContext.

IResourceContext m_context;

I can get IUser from it like

m_context.getUser();

But I have to get IPricipal for JCA (Connector Framework to invoke an ABAP rfc).

I'm unable to figure it out, Kindly help me.

Thanks and regards

Radha Krishna .B

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

are you talking about com.sap.security.api.IUser?

If so, this interface already extends com.sap.security.api.IPrincipal

Did you just try to use the m_context.getUser() as parameter for the JCA?

I do not know much about JCA. Maybe JCA needs another interface IPrincipal? Can you check the complete package name of IPrincipal needed by JCA?

Kind regards,

Ralf

Former Member
0 Kudos

Hi Ralf,

Thanks for looking at my post.

m_context.getUser() returns com.sapportals.portal.security.usermanagement.IUser, which is imcompatible with com.sap.security.api.IUser.

So a build error occurs.

Thanks and regards

RB

Former Member
0 Kudos

Hi,

it is deprecated, but you can try:


com.sap.security.api.IUser umeUser= m_context.getUser().getUMEUser();

Best regards,

Stefan Brauneis

Former Member
0 Kudos

Hi,

com.sapportals.portal.security.usermanagement.IUser is an user instance of the old usermanagement API used by KM.

If you call the method "public com.sap.security.api.IUser getUMEUser()" on that "old" IUser, you will get a "new" IUser (IUser of the new usermanagement API.

The new IUser already implements the IPrincipal interface (see my previous post).

I hope this solves your problem.

Kind regards,

Ralf

0 Kudos

Hi, Radhakrishna,

you can use the IUserFactory.getUMEUser method. First,

get the user factory with the following code:


import com.sapportals.portal.prt.runtime.PortalRuntime;
import com.sapportals.portal.prt.service.usermanagement.IUserManagementService;
import com.sapportals.portal.security.usermanagement.IUserFactory;

IUserFactory fac = (IUserManagementService) PortalRuntime.
                      getRuntimeResources().
                      getService(IUserManagementService.KEY);

Then get the corresponding UME user with:

fac.getUMEUser(yourUserObject)

Now you have an object that can be used as an IPrincipal because

com.sap.security.api.IUser is a subinterface of com.sap.security.api.IPrincipal.

Hope this helps, and don't hesitate to ask if anything remains unclear.

Heiko

Former Member
0 Kudos

Hi Heiko,

The problem is many of the classses and interfaces are depricated.

IUSerFactory ais also deprecated.

Can you kindly suggest new methods of doing it?

Thanks and regards

Radha Krishna .B

0 Kudos

Hi, Radhakrishna,

yes, they are deprecated but they are still used by the KMC APIs until NW 2006. So, basically, ignore the "deprecated" messages. As soon as the new User Management Engine (UME) is supported by the APIs you can (but need not right away, as the old calls will be supported for some time) migrate to the new principal objects.

Cheers,

Heiko

Former Member
0 Kudos

Hi Heiko,

Thanks a lot for your help.

When and where can I get the info regarding new UME APIs?

What are the possible dates of new APIs availability?

Are the new APIs not available at all now?

Thanks and regards

Radha Krishna .B

0 Kudos

Hi, Radhakrishna,

it depends. If you are already working on KMC 7.1 they are available otherwise not. In general, as soon as you are working on NW 2006 KMC they are available (which in turn depends on your development strategies).

The new methods look exactly the same as the old ones except that if these took user management objects such as users as arguments they then take the new UME objects, that's about it.

Regards,

Heiko

Answers (0)