Re: Get JahiaDBUser on Portlets

"Ricardo Ferreira" <[email protected]> Fri, 9 Mar 2007 10:22:10 +0000
Newsgroups gmane.comp.cms.jahia.devel
Message-ID <[email protected]>
Hi KT,

I would like to thank you for your quick reply.

What i really need to do is develop a web interface (portlet JSR168) to
access an authentication and authorization (using roles - user can access
portlet if he has roles, and can access enterprise content if he has rights
to do that) webservice, that is running on jboss. So i need to authenticate
on webservice, and i would like to use the same login/password. I can
"force" user to insert login/password inside portlet, but if you could see
anyway to do this, i would thank you...
So... on jahia, can you see a way to authenticate on jboss with same jahia
login/pass?

But Khaled... why i get a "org.jahia.services.usermanager.JahiaDBUser" when
i log request.getUserPrincipal().getClass()? I shoudn't get Principal class?


Regards,

Ricardo Ferreira




On 3/9/07, Khaled TLILI <[email protected]> wrote:
>
> Hi,
>
> There are 2 types of portlets supported by Jahia: jahiaWebapps (only for
> Jahia 4 and 5)and portletJSR168 (only jahia 5 and JSR168 portal). It's
> better and recommended to develop a portlet JSR168.
>
> You find the specification here:
> http://jcp.org/en/jsr/detail?id=168
>
> A portlet JSR168 can't access to user's password. It's not the job of
> the portlet to deal with sign on.
>
> User's login is retrieve like that:
> java.util.Principal p = request.getUserPrincipal();
> or
> String login = request.getRemoteUser().
>
> It's NOT possible to access  Jahia objects or classes. So JahiaDBUser
> has no meaning to a portlet.
>
>
> KT.
>
>
> Ricardo Ferreira a écrit :
> > Hi all,
> >
> >
> > i'm a noobie with jahia (i'm using 5.0.1) and I'm trying to devep a
> > portlet. Inside my portlet i need to get the username and password for
> > user that is accessing to portlet.
> > If i log " request.getUserPrincipal().getClass()" i get an JahiaDBuser:
> >
> > "class: org.jahia.services.usermanager.JahiaDBUser"
> >
> > But if i do:
> >
> > JahiaDBUser juser = (JahiaDBUser) request.getUserPrincipal();
> >
> > i get an exception:
> >
> > "- JetspeedContainerServlet: Error rendering portlet
> > "MyPortletSystem::MyortletSystem": java.lang.ClassCastException:
> > org.jahia.services.usermanager.JahiaDBUser
> > java.lang.ClassCastException :
> org.jahia.services.usermanager.JahiaDBUser"
> >
> > Can you help me?
> >
> > Regards on advanced,
> >
> > Ricardo Ferreira
> > ------------------------------------------------------------------------
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.446 / Virus Database: 268.18.7/713 - Release Date: 3/7/2007
> 09:24
> >
>
>