added code for single signon

NOTE: More changes required in redirect uri. Doesn't work right now. But
all the code is in place.