Page 1 of 1
OpenKM and CAS
PostPosted:Thu Feb 17, 2011 3:30 am
by tintin_chan
Hi I have written a custom AuthenticatorBase class such that when CAS valid ticket is returned, the custom login module in login-config.xml will perform the authorization.
However even though I have my user name and correct role AdminRole set, I have encountered errors during loading of the OpenKM main page. There are errors such as "Error on getting extensions UUID". A capture of the screen is done below:
http://img405.imageshack.us/i/errorjz.jpg
Can anyone enlighten if I am missing something on my implementation? Thanks.
Re: OpenKM and CAS
PostPosted:Thu Feb 17, 2011 5:54 am
by tintin_chan
Hi,
Upon browsing through the log file, i found the follow error in detail
Caused by: java.lang.NullPointerException
at com.openkm.frontend.server.OKMWorkspaceServlet.getUserWorkspace(OKMWorkspaceServlet.java:284)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
The error is caused by the following lines in the class OKMWorkspaceServlet
user = AuthDAO.findUserByPk(getThreadLocalRequest().getRemoteUser());
workspace.setEmail(user.getEmail());
My guess is getThreadLocalRequest().getRemoteUser() is null. How do i populate the remote user attribute?
Re: OpenKM and CAS
PostPosted:Thu Feb 17, 2011 4:00 pm
by pavila
getThreadLocalRequest().getRemoteUser() get the current authenticated user in the web app. If the resource is protected, the user must authenticate to access it and then you cat get the remoter user. OpenKM has its resources protected, as any typical web application and this is done in the web.xml and jboss-web.xml. If you are not familiar with CAS and / or J2EE I would recommend to start with a little web application and then try with OpenKM.
Re: OpenKM and CAS
PostPosted:Mon Apr 11, 2011 5:57 am
by tintin_chan
The solution to the problem is that I have not set the email of the user in the database, resulting in a null exception in user.getEmail().
In order to use CAS with OpenKM, one has to write a custom Authenticator class and includes it in the /server/default/deploy/jboss-web.deployer/META-INF/jboss-service.xml

Re: OpenKM and CAS
PostPosted:Wed Apr 13, 2011 9:12 am
by pavila
Would you like to share the source code with us? Please, attach the java or zip archive to this forum topic.