Jacob,

I think that you can somewhat achieve this by declaring 'username' and
'password' parameters for your portlet and then set the 'source' parameter
as follows:
https://${username}:[EMAIL PROTECTED]/myapp/myservlet. Of course,
the user would have to customize the portlet to provide their credentials.

Best regards,

Mark Orciuch - [EMAIL PROTECTED]
Jakarta Jetspeed - Enterprise Portal in Java
http://jakarta.apache.org/jetspeed/
> -----Original Message-----
> From: Jacob Kjome [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 06, 2003 3:54 PM
> To: [EMAIL PROTECTED]
> Subject: obtaining User object when overriding the IFramePortlet
> getSource method???
>
>
> Hi,
>
> I'm wondering how I might obtain a handle on the JetspeedUser object
> when overriding the getSource() method of the IFramePortlet?
>
> The reason I need this is so that I can grab the logged-in user's
> username and password and send that info along with the URL that is
> configured via the .xreg file in order to provide BASIC authentication
> information automatically to the app running in the IFrame.  So....
>
> <portlet-entry name="MyPortlet" hidden="false" type="ref"
>     parent="IFramePortlet" application="false">
>     <security role="turbine"/>
>     <security-ref parent="user-only"/>
>     <meta-info>
>         <title>My Portlet</title>
>         <description>A custom example IFramePortlet</description>
>     </meta-info>
>     <classname>com.mycompany.portal.portlets.MyIFramePortlet</classname>
>     <parameter name="source"
>         value="https://www.myserver.com/myapp/myservlet";
>         hidden="false" cachedOnName="true" cachedOnValue="true"/>
>     <media-type ref="html"/>
>     <url cachedOnURL="true"/>
>     <category group="Jetspeed">frames</category>
> </portlet-entry>
>
>
> Then in the overridden getSource() method of MyIFramePortlet, I
> grab the current
> source defined in the config (above).  After that I need to, somehow,
> access the User object so I can do getUsername() and
> getPassword().  It would look something like this...
>
> public String getSource() {
>     String source = super();
>     if (source == null) return null;
>     int index = source.indexOf("https://";);
>     if (index == -1) {
>         index = source.indexOf("http://";);
>     }
>     if (index != -1) {
>         String user = runData.getUser().getUserName();
>         String pass = runData.getUser().getPassword();
>         String beginStr = configSource.substring(0, index);
>         String endStr   = configSource.substring(index);
>         StringBuffer buff = new
> StringBuffer(user.length()+pass.length()+source.length()+2);
>         source =
> buff.append(beginStr).append(user).append(":").append(pass).append
> ("@").append(endStr).toString();
>     }
>     return source;
> }
>
> The end result of all this would set the source for the IFrame as
> something like...
>
> https://myusername:[EMAIL PROTECTED]/myapp/myservlet
>
>
> For the above to work, though, I need some way to get the RunData
> object or another object which provides access to the User object.
>
> Is there any way to make this work?
>
> Jake
>
>
> --
> Best regards,
>  Jacob                          mailto:[EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to