Thanks for the quick response. As a workaround to avoid changing wsrp4j itself,
I'm using the following "workaround" in my LoginModule. It works but its very
specific to wsrp4j:
Object provider = InformationProviderAccess.getDynamicProvider(req);
Field userContextField = provider.getClass().getDeclaredField("userContext");
userContextField.setAccessible(true);
Object userContext = userContextField.get(provider);
if (userContext == null)
{
throw new FailedLoginException("User context not present");
}
Field userContextKeyField =
userContext.getClass().getDeclaredField("userContextKey");
userContextKeyField.setAccessible(true);
Object userContextKey = userContextKeyField.get(userContext);
if (userContextKey == null)
{
throw new FailedLoginException("User context key not present");
}
return String.valueOf(userContextKey);
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[EMAIL PROTECTED] escribió:
> I am using Jetspeed 2.0 with wsrp4j consumer talking to a Tomcat instance
> with the wsrp4j producer deployed. When I've logged into Jetspeed, it sends
> the following fragment in the <getMarkup> message:
>
> <userContext>
> <userContextKey>admin</userContextKey>
> </userContext>
>
> where "admin" is the Jetspeed username. This is what I expect and I've tested
> that Oracle Portal 10g does the same thing.
>
> The question is: how can I get access to the user from within my JSR-168
> portlet?
>
> Looking at the wsrp4j code, the UserContext is placed in a
> DynamicInformationProviderImpl object and this is set as an attribute called
> "org.apache.pluto.portalImpl.DynamicInformationProvider" on the request.
> However, this class does not expose the UserContext.
>
> The Pluto RenderResponseImpl is extended by WSRPRenderResponseImpl but the
> same isn't done for RenderRequestImpl so getRemoteUser() returns null.
>
> Am I missing something?
>
> Regards,
> Terry
I'm not sure if producer exposes this functionality right now (but it
should). Theoretically, you should be able to get the user information
through the request.getAttribute(PortletRequest.USER_INFO) object, but
as I say I don't know if producer maps this info right now.
I'll try to take a look at the code this week, but I can't promise anything.
Regards.
Diego.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFdoLvgyzZYflJelERAugNAJ43Do55KwC1ztCTDn3mDbMmxlcUCACgnJTN
h3FF5TVaGG8TvSvdsMuDV6M=
=LbWR
-----END PGP SIGNATURE-----
--- End Message ---