Home > Cloud, Java > Extending Vosao CMS through Custom Plugin Development

Extending Vosao CMS through Custom Plugin Development

August 19, 2011

In my last post, I shared our experiences about building a large organization’s Intranet on Google App Engine using Vosao as underlying CMS. During that time, I touched upon Vosao’s extensible architecture which lets developers easily extend it’s functionality through plugin-based framework. In this post, I would like to talk about one of the plugins, we developed for our Intranet application.

Our requirement was that only authenticated users should be able to access the Intranet. Once that’s done, we should be displaying a Welcome message with connected user’s name and also provide a log-out URL at the top of all the pages. Fairly standard requirements, we would say for any company’s intranet but Vosao is designed to develop any interactive web-sites. It doesn’t impose any authentication mechanism for accessing the web-application and this seems logical as well. The decision about whether and which type of authentication is required is completely dependent on the application we are trying to develop.

For the Authentication part, we used Google Apps Authentication provided by App Engine. You can find more information about the same here. Once we are sure that anyone accessing Intranet is an authenticated Google Apps user, the next steps are :

  • Getting the connected user’s details
  • Displaying the user’s name and log-out URL on all our HTML pages

Getting Connected User’s Details
For those who have worked with Google App Engine, getting a connected user details is pretty straight forward. You need to call Google User Service for the purpose. It also provides you methods for getting login and logout URL’s which can redirect the users to the appropriate Google/Google Apps authentication pages. Here is the Java code snippet for the purpose:

import com.google.appengine.api.users.UserServiceFactory;
public class GoogleUserDetailsVelocityPlugin extends AbstractVelocityPlugin {

public String getEmail() {
    try {
      return UserServiceFactory.getUserService().getCurrentUser().getEmail();
    } catch (Exception exception) {
       //do Something

  public String getLogoutUrl() {
    try {
      return UserServiceFactory.getUserService().createLogoutURL("/");
    } catch (Exception exception) {
       //do Something

Displaying User Details on Web Application
We should be able to access these methods in our content pages. This is where developing your own Vosao plugin comes into picture. Vosao team has provided very good documentation for the purpose on their web-site. Along with this, you can also access the source code of some of the plugins developed by Vosao team themselves as a starting point.

The plugin once developed needs to be packaged in the form of war file and then installed on Vosao. Once done, you can easily access plugin’s methods through Velocity markup language in any of your templates or content pages. In our case, we had to just put following lines of code for accessing connected user’s name and logout URL:

<a href="${plugin.googleuserdetails.getLogoutUrl()}">Logout</a>

For those interested in giving this plugin a try or even better extending its functionality, we have put the entire source code on GitHub for you to use and explore. We would love to have your feedback and comments.

About these ads
Categories: Cloud, Java Tags: , ,
  1. June 4, 2012 at 10:10 PM | #1

    ok this is all fine and dandy, but how the hell do you interactively debug in eclipse while developing this plugin? Do i have to deploy to a war file everytime? What is the recommended approach for incorporating into eclipse or other ide development, I’m a noob and lost.

Comments are closed.

Get every new post delivered to your Inbox.

%d bloggers like this: