on 2005 Feb 25 12:07 PM
Hi,
I'm triyng to instantiate a ressource context with the current user.
I tried to proceed the following way :
com.sap.security.api.IUser nwUser;
nwUser = request.getUser();
IResourceContext resourceContext = (IResourceContext)new ResourceContext(nwUser);
But it seems the ResourceContext constructor needs a different IUSer. (com.sapportals.portal.security.usermanagement.IUser)
So i tried to convert the user with
com.sapportals.portal.security.usermanagement.IUser user = WPUMFactory.getUserFactory().getEP5User(nwUser);
But this leads to an error a the execution of my servlet on the portal.
I use EP6.0 SP9.
Is there another way to get the current user in a servlet and then instanciate a resourceContext from it ?
Thanks
Sylvain
Message was edited by: Sylvain
Hi Sylvain,
> But this leads to an error a the execution
Please, be more specific:
What error? What message? What stack trace (maybe from logs)? Almost nobody will be able to guess what can be wrong if not even an error message / detail is presented...
"Almost nobody" - maybe I'm the exception
Did you add com.sap.portal.usermanagement to the SharingReference section of the portalapp.xml?!
Hope it helps
Detlev
PS: Please consider rewarding points if answers are helpful. Thanks in advance!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Detlev,
I added com.sap.portal.usermanagement to the Java build path of my projet but did not mention it in portalapp.xml. Is it not sufficient ?
Here is the french error message :
Erreur d'exécution portail
Une erreur est survenue lors du traitement d'une requête pour :
iView : N/A
Nom du composant : N/A
com/sapportals/wcm/repository/ResourceContext.
Exception id: 09:40_28/02/05_0040_1212950
See the details for the exception ID in the log file
Anyway, I changed my strategy and created a j2ee project with a servlet.
In this servlet I proceed the following way :
com.sap.security.api.IUser newUser =
UMFactory.getAuthenticator().forceLoggedInUser(
request,
response);
com.sapportals.portal.security.usermanagement.IUser user
= WPUMFactory.getUserFactory().getEP5User(newUser);
ResourceContext c = new ResourceContext(user);
This way I get a valid user. But this was not exactly what I wanted because here, I have to enter the user login in a sap logon screen whereas I wanted to be able to perform the login process within the code (with a username/password in parameter of my servlet).
Thanks for your answer
Sylvain
Hi Sylvain,
> to the Java build path of my projet but did not
> mention it in portalapp.xml. Is it not sufficient ?
No, they are totally independent. See: The Java Build Path is for Eclipse being able to resolve the imports etc and to check against definitions. This only has effects on <i>build</i> time.
Whereas by setting the SharingReference within portalapp.xml you are telling the portal how the classloader for your application has to be built, what other public parts of applications have to be within it. So this is for <i>runtime</i>.
> I wanted to be able to perform the login process
> within the code (with a username/password
> in parameter of my servlet).
Hope it helps
Detlev
Hello,
I am also trying to create a ResourceContext. My code is
import com.sapportals.portal.security.usermanagement.IUser srvUser = null;
srvUser= WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
resourceContext = new ResourceContext(srvUser);
This works but I now get the message that the IUser object is depracated and that one should use com.sap.security.IUser. This object however cannot be used in the ResourceContext constructor.
I cannot find anyway of not using the depracated objects. What is one meant to do in such circumstances?
Thanks
Mr.T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
8 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.