Re: Get JahiaDBUser on Portlets

Khaled TLILI <[email protected]> Fri, 09 Mar 2007 09:04:42 +0100
Newsgroups gmane.comp.cms.jahia.devel
Message-ID <[email protected]>
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
>