Single Sign-On between Joomla (PHP) and a custom JSF / JSP login (JAVA)

Single sign-on (SSO) is a method of access control, that enables a user to authenticate once, and gain access to the resources of multiple software systems. Well in my case, the task i have given is to authenticate a user in a PHP and a JAVA (Web) system simultaneously.

My PHP web application is the well known Joomla CMS, and my JAVA web application is based on JSF and custom built. After some thinking and research I found several resources which are worth reading (JOSSO, OneSign ), but i couldn’t take any help from them, mostly those SSO frameworks are complex ( yeah 🙂 I couldn’t understand ) and aimed on a general pourpose and most of them are not for free.

So yeah I thought of doing some Hack to joomla and also make some changes in my Java web app’s authentication method. After talking with some of my geeky Friends (Sandaruwan and Anjana). I came up with two approaches. both are involved in handling the cookies manually up to certain extent.

The 1st approach is (Which i didn’t try and had to give up due to the reason that I am using JSF as the web application framework) to log-in to the Joomla site and after loged in to Joomla create a random named temp file in the server (possibly in /home/secrets with 777) with the user-name (if a valid log in) and set a cookie using set_cookie(“name”,$filename) and direct to a jsp page to do the java side authentication.

in this JSP, page read the secret file name from the cookie and read the file from the http server in-order to take the username of the loged-in user. By passing this to the authentication method of the java web app, the java side also can be authenticated.

yup it is pretty simple, but i had to give it up mainly because I use JSF. if I do the user authentication in the above way in the java side. I cannot add the user object to the FacesContext which will be used by my other java side components. so even though i log in. later on in other jsf pages my loged user cannot be found. (Shortly my java login process is not happening according to the JSF implementation procedures.) and secondly i had to give up this method because my Project manger didn’t like the idea of saving temp files in the server. 🙂

So the Second and the method which i have implemented is, automating the Joomla log-in process by making an http request to the http server from my JSF backing bean. and set the PHP cookie manually via Http Servlet response.

before i explain this method more broadly i have to mention about two nice tools which helped me to monitor the http requests and response.
Apache TCP Monitor
Live Http headers (FireFox ad-on)



There are two different scenarios.
1. User can visit teh home page of the joomla site 1st and the PHP Cookie is already set.
2. User visit the Java site PHP Cookie is not available.

Continue reading Single Sign-On between Joomla (PHP) and a custom JSF / JSP login (JAVA)


JEvents Hack – Integrating JEvents with Google calender

As i promised today I got some time to write about some PHP programming i did few weeks ago. I had to integrate Google calender with the Sensoria web site, so that the events published in the sensoria site will be automatically published in Sensoria’s public Google calender.

Sensoria Site is created using a famous CMS called Mambo, in Mambo one can install plug-ins for many usage for the customized site they are creating. In this case Sensoria was using Mambo Events Component or now available to download as JEvents in Joomla CMS.

What I did was a small code hack in the eventmanager.php file in com_eventmanager folder in the components directory of Mambo. Its was a pretty easy task, but i had problems while testing. I was behind a proxy and the Zend framework gave a huge trouble when connecting to Google Via an HTTPS connection. After some descutions on Google calender forums.. I found out that it is a bug in the Zend Farmework (Which i could not find a solution and didn’t bother or had time to spend on fixing it). So i had to test it in a live server.

Any how now its all working.. I will publish the code out here.. so anyone who wants to do the same.. please feel free to use it..


cheers !!

UNIX / LINUX based Client & a Server application

Okey so am writing after some time about some valuable thing !! This is about some thing I happened to do as an assignment for one of my degree modules (Network Application Development). The Assignment is to implement a server and a client using both TCP and UDP. The functionalities expected were, a centralized server which keeps records of the online connected buddies in the network (Subscription) Continue reading UNIX / LINUX based Client & a Server application

Installing Gnome(cairo)-Dock

Today while i was surfing the net (digging new gadgets for my Gnome desktop) i saw some interesting screenshots of a universal dock something which is similar to the OSX making me hunt down this new feature to my desktop. i googled for “Gnome dock” and found a post in ubuntu forums where i followed the installation process and at last.. yes !! I got the DOCK but there were no application images seen in the DOCK. i solved this problem by editing the .svg files and the cairo-dock.c file. but the biggest problem i encountered was that when i added this to the sesion and restarted my X-server. I crashed or rather I didn’t see my desktop at all. (well for some wired reason it crashes only the desktop.) I think this happens when the Gnome session loads Beryl-manager, Beryl, Gdesklets and the cairo-dock at the same time it might get overloded and crashes the desktop.

Anyhow as a solution i delayed the loading process of each of these applications through a shell script. so on this post I will describe how to install cairo-dock and make it work hand to hand with beryl.

You can follow the instructions on the Ubuntu forum for the installation process. since it describes well I will write what is missing.

At the step 5 before download cairo-dock.tar.gz i signed up for the ubuntu forum.

At last after the installation process is done when you run cairo-dock it will appear in the bottom of your desktop with almost no images for the named applications. These application icons are saved as .SVG files in the cairo directory what you have to do is open each of these files and replace the link to the image with your application icon’s path.


replace the highlighted link with your icon’s path and secondly you can add/remove applications from the dock by edition the cairo-dock.c file. there in the specified section you have to add the name of the .SVG file, name of the application and the command to launch that application and make it. this is the simple way to make the DOCK running with the applications you want in your desktop. If at the end when you add the DOCK to the session and restart and if then your Desktop crashes, simply write a shell script and save in /usr/bin/ and add that script to run on the beginning of the each session.

my scripted looked like this.

sleep 5
sleep 7
cd /opt/cairo-dock
./cairo-dock –no-glitz &

restart your X and you must be smoothly working !!! Enjoy…

Credits :

Sandaru1 & Kasun

AiGLX and Beryl On Ubuntu Edgy

Haah !!! after few days of playing on Ubuntu I decided to write some thing on things what I did to make my Gnome desktop more eye catching… I have heard of XGL working on Gnome providing a surprising effects !!! But also I have heard and seen that XGL effects works in much slower motion in most of Intel on board graphic cards (intel i915), so due to this fact I was searching for alternatives and found AiGLX which comes bundled with Ubuntu Edgy… I decided to try this hence many Online articles have recommended AiGLX + Beryl combination works well in intell chipset.

What I did was simple configured the AiGLX as shown in the wiki and installed beryl !!! And yes As it says It works well…. but small suggestion when you make a session and load that in the start-up the ubuntu start-up gets much slower !!! So my idea is to place a small shell script to load the beryl manager and beryl and make it run in the start-up.. this will make the system faster than defining a separate session. my friend sandaruwan have described of this method in a detail manner.

for the Intel i915 chipset users now have AiGLX+beryl to have the same experience where you will get by adding XGL !!!! As the last word for the post I would like to say…Now my Ubuntu OS is incomparable with the Windows in anyway of its appearance.