Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Zimlets

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-19-2008, 06:48 PM
Junior Member
 
Posts: 7
Default [SOLVED] Test to see if application is being run by authenticated user

Hello,

I am nearly finished porting a PHP application to a Zimbra 5.0 server. It will be invoked using a zimlet. It uses a "normal" web server (i.e. not Zimbra) which is guaranteed to be on the same server as the Zimbra server. It uses a different port, and uses SSL (https) only.

Everything works fine, except that I need to validate the application was invoked via the Zimlet and not merely connected to from the "outside" (i.e. from the internet). Here's the application flow:

- User logs into Zimbra, sees and clicks on Zimlet
- Zimlet has an action url that says "https://host.domain:20443/some/path
- PHP app is at /some path and is handled by the other web server
- The app validates that this user has already logged into Zimbra and does not have to re-authenticate.

Here's the zimlet:

<zimlet name="com_phpministry_oss" version="1.0" description="Database">
<includeCSS>oss.css</includeCSS>
<resource>oss.gif</resource>
<zimletPanelItem label="Manage All My Seminars" icon="oss-panelIcon">
<toolTipText>Right-click to Schedule Seminar</toolTipText>
<contextMenu>
<menuItem label="Online Seminar Scheduling" id="mail.testserver.us:20443/oss" icon="oss-panelIcon">
<canvas type="window" title="Support Form" />
<actionUrl method="post" target="https://mail.testserver.us:20443/oss">
<param name="param">${setting.USERNAME}</param>
</actionUrl>
</menuItem>
</contextMenu>
</zimletPanelItem>
</zimlet>

The problem:

A user from the outside can connect to this URL directly from the outside. I need a piece of code in
/some/path/index.php

that says:

if ($This came from the Zimlet)
{
echo "It's ok to enter"
}
else
{
echo "It's not ok to enter";
}

How do I test to see if this user has actually gotten here via the zimlet?

Thanks and regards,

Dave
Reply With Quote
  #2 (permalink)  
Old 11-20-2008, 01:55 AM
Active Member
 
Posts: 40
Default

You could send a SOAP request to Zimbra to authenticate the user. See this.
Reply With Quote
  #3 (permalink)  
Old 11-20-2008, 07:04 AM
Junior Member
 
Posts: 7
Default zm_auth_no longer passed

I thought about that, but ZM_AUTH_TOKEN is no longer passed from the zimlet to the application in a cookie as it used to be under 4.5.6_GA_1044.RHEL5_20070706163724 (my production box, where I also tested that possibility).

Is the value of ZM_AUTH_TOKEN available to the Zimlet where I could pass it as a parameter to the app, something like:

<param> ${ZmSetting.ZM_AUTH_TOKEN} </param>

from within the Zimlet?

Thanks and regards,

Dave
Reply With Quote
  #4 (permalink)  
Old 11-21-2008, 06:26 AM
Junior Member
 
Posts: 7
Default Mea Culpa

Oy.

Zimbra DOES pass ZM_AUTH_TOKEN in v5. I had changed the domain (mail.test.us and test.us), so the cookie didn't make it to my php app. I'm going to try the soap call now.

Thank you, agnes
Reply With Quote
  #5 (permalink)  
Old 11-30-2008, 07:28 PM
Junior Member
 
Posts: 7
Default works now

The authorization token did, indeed, show up when the domains were the same. Cocurrently, I figured out how to get a SOAP call to work in PHP, and I used the ZM_AUTH_TOKEN to validate, and all is working now.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.