File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JForum and the fly likes sso encoding bug and how to repair it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "sso encoding bug and how to repair it" Watch "sso encoding bug and how to repair it" New topic
Author

sso encoding bug and how to repair it

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
if you use jforum in different language as chinese or japanese , you will find you can not use those language to register or login in. the reason is that in cookie the username must encoding bing URLEncoding , i modifying two place to correct this bug ,the example just as below:

public String authenticateUser(RequestContext request) { // required method
User user = new User();
Cookie myCookie = ControllerUtils.getCookie("JforumSSO"); // my app login cookie
String username=null;
if (myCookie != null) {
//DAOManager manager = new JndiDAOManager(); // my apps database
UserDAO userDAO = DataAccessDriver.getInstance().newUserDAO();
//shuichao, modify this bug 1
String cookieUserName=URLDecoder.decode(myCookie.getValue());

user = userDAO.selectByName(cookieUserName);


} else
return null; // no cookie found

request.getSessionContext().setAttribute("password", user.getPassword()); // set correct password
request.getSessionContext().setAttribute("email", user.getUsername()); // and email address (my username)
//shuichao, modify this bug 2
ControllerUtils.addCookie("JforumSSO",URLEncoder.encode(user.getUsername())); //refresh

return user.getUsername(); // jforum username
}
[originally posted on jforum.net by shuichao]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I have seen that you have solved everyones problem in regarding SSO,I also asking help from you,hope you will be help me.
I am newbie and not properly a java guy. I want to enable SSO with my simple webapplication developed through JSP and Servlet in Tomcat Server with Mysql database. My application is running in the same local host and jforum is also in the same.I have working through it for last 10 days,,, now it really becoming hard to find anything.My pre\oject delivery is after 2days from tdays post.Please help me how to configure systemglobal.properties and web.xml without implement anyclass.My jforum is running properly otherwise. And its too good.As there is stated in the documentation in remoteuserSSO that we just need to configure systemglobal.properties and web.xml .I found it the easiest way to make it woprkable.There is one login modul;e in the webapplication which am taking in Session.I can change my code if u want.But please guide me properly and give me the step wise help. PLease PLease PLease PLease PLease.. I need your help badly.


[originally posted on jforum.net by abhirup]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
i think the JForum's document have describe how to use SSO clearly, i don't kown which problem had confront u,can u tell me the problem certainly
[originally posted on jforum.net by shuichao]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
actually I have done exactly in the way what SSORemote documentation have.Just edited the systemglobal.properties file,web.xml and opened the tomcat single sign on valve. I am using Jforum 2.1.8.
I haven't added done any coding in jforum.I have a webapplication with login screen where after login am redirecting to a page where there is link to jforum in Iframe.I have set the username and password in session in that page.
But when after login I am going to jforum its showing annonymouse user.And if I login in tomcat manager before starting the application,it is taking Admin as a user.

I am just not getting where is the problem.Can u tell me simple stepwise implementation How I can integrate it without modifying jforum code,and doing exactly in the way defined in SSOREMOTE documentation.
please help me.My project dead line is near by.
I will be highly obliged if you help me.I can find many reason to thank you.
[originally posted on jforum.net by abhirup]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
... i think you might have troubles with the "issessionvalid" or something like that.

One thing you have to implement is the "authenticateUser" Method. but of course - at each click - the application will check if the user is still valid within the session (it might be he logged out or whatever). So if this method returns "false" from the start, then it will automatically set the internal user to anonymous. easy as can be. so what you need to find out is mechanisms how to determine if the user currently is still logged on correctly. ..

You might want to add the debugging output to that method and see if it returns null or a valid username - this will be a good indicator. Of course the easiest to figure out the issue would be running the forum from within an IDE - as this will alow you debugging step by step and check for attribute values
[originally posted on jforum.net by Sid]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sso encoding bug and how to repair it