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

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 02-05-2007, 12:42 AM
Starter Member
 
Posts: 2
Default Integrate Zimbra into 3rd-party portal

Hi,

i'm looking for a way to integrate zimbra with our portal. I need to show a page in our portal with the inbox of a user (i already figured the single sign on, it works), with the possibility to open an email and reply to / forward / etc it.

If that isnt possible, is there a way to jump directly into an email, because i can list the mails of a user by reading directly from the imap server, but don't want to implement all the (very nicely done) functionality of replying (addressing) and forwarding.
Regards,

doubleju
Reply With Quote
  #2 (permalink)  
Old 02-05-2007, 07:25 PM
Former Zimbran
 
Posts: 5,606
Default

Hi Double,
We'd be interested in hearing how you incorporated the SSO concept. This has been a topic of intrest for a while.

In any case, there have been many ideas tossed around in regard to a welcome page.

The one with the most weight behind it is the concept of a "welcome" page. (Search the bugzilla for that).

I'd say vote for it. That will give you more of an idea of how you can create a welcome page for yourself.

If it's not what you want, please by all means, file a bugzilla. We welcome our users ideas, and want to hear what you want.

Thanks
john
Reply With Quote
  #3 (permalink)  
Old 02-05-2007, 11:28 PM
Starter Member
 
Posts: 2
Default

Hi Tenor^^

thanks for replying, i will look for the idea with the welcome-page later today.

For the SSO, i followed this source.

Quote:
In order for preauth to be enabled for a domain, you need to run the
zmprov command and create a key:
prov> gdpak domain.com
preAuthKey: 4e2816f16c44fab20ecdee39fb850c3b0bb54d03f1d8e073aa ea376a4f407f0c
So i used
/opt/zimbra/bin/zmprov zimbra-server.behind-our-portal.ext
to generate our secret (referred as "generatedZimbraSecret" below) and implemented the following jsp:

Code:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="de.our.company.sessionmanagement.*, java.io.*,java.text.*,java.util.*,java.security.*,javax.crypto.*" errorPage="" %><%!
  public static  String computePreAuth(Map<String,String> params, String key) 
  {
        TreeSet<String> names = new TreeSet<String>(params.keySet());
        StringBuilder sb = new StringBuilder();
        for (String name : names) {
            if (sb.length() > 0) sb.append('|');
            sb.append(params.get(name));
        }
        return getHmac(sb.toString(), key.getBytes()); 
    }

    private static String getHmac(String data, byte[] key) {
        try {
            ByteKey bk = new ByteKey(key);
            Mac mac = Mac.getInstance("HmacSHA1");
            mac.init(bk);
            return toHex(mac.doFinal(data.getBytes()));
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException("fatal error", e);
        } catch (InvalidKeyException e) {
            throw new RuntimeException("fatal error", e);
        }
    }
    
    static class ByteKey implements SecretKey {
        private byte[] mKey;
        
        ByteKey(byte[] key) {
            mKey = (byte[]) key.clone();;
        }
        
        public byte[] getEncoded() {
            return mKey;
        }

        public String getAlgorithm() {
            return "HmacSHA1";
        }

        public String getFormat() {
            return "RAW";
        }       
   }

    public static String toHex(byte[] data) {
        StringBuilder sb = new StringBuilder(data.length * 2);
        for (int i=0; i<data.length; i++ ) {
           sb.append(hex[(data[i] & 0xf0) >>> 4]);
           sb.append(hex[data[i] & 0x0f] );
        }
	return sb.toString();
    }

    private static final char[] hex = { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' ,'8' , '9' , 'a' , 'b' , 'c' , 'd' , 'e' , 'f'};


%><%
	// *********************
  	// No Cache
  	response.addHeader("Pragma", "no-cache");
  	response.addHeader("Cache-Control", "no-cache");
  	response.addHeader("Cache-Control", "no-store");
  	response.addDateHeader("Expires", 0);
  
	UserSession.check(request,response);
	UserBean userBean=(UserBean)request.getAttribute("userBean");
	String account=(String)userBean.get("mail");
	String pwd=(String)userBean.get("userPassword");
	String timestamp=""+System.currentTimeMillis();
	HashMap<String,String> params = new HashMap<String,String>();
	params.put("account", account);
	params.put("by", "name"); // needs to be part of hmac
	params.put("timestamp", timestamp);
	params.put("expires", "0");
	String key = "generatedZimbraSecret";
                               
	String preAuth=computePreAuth(params, key);
	//     out.println(preAuth+"<br>");
		 
	String url="https://zimbra-server.behind-our-portal.ext/service/preauth?account="+account+"&expires=0&timestamp="+timestamp+"&preauth="+preAuth;
	response.sendRedirect(url);
	//	 out.println(url);
%>
Running this jsp in an iframe somehow works for us, but as zimbra takes a while to load it's not the optimal solution.
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.