[opencms-dev] OpenCMS authentication CLARIFICATION
Bill Edwards
wse at jimmy.harvard.edu
Fri Jul 7 17:24:10 CEST 2006
Apologies for any confusion that my previous messages on this subject
may have caused--please disregard them. I have narrowed down my
exception to line 1734 of OpenCmsCore.java (in OpenCMS 6.2.1):
user = m_securityManager.readUser(contextInfo.getUserName
());
Here is part of the stack backtrace:
java.lang.NullPointerException
at org.opencms.main.OpenCmsCore.initCmsObject(OpenCmsCore.java:1734)
at org.opencms.main.OpenCmsCore.initCmsObject(OpenCmsCore.java:701)
at org.opencms.main.OpenCmsCore.initCmsObject(OpenCmsCore.java:726)
at org.opencms.main.OpenCms.initCmsObject(OpenCms.java:551)
at org.frontier.ecog.opencms.auth.OpenCmsAuth.<init>
(OpenCmsAuth.java:42)
And here is my OpenCmsAuth class in full:
package org.frontier.ecog.opencms.auth;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.frontier.webapp.util.*;
import org.opencms.file.*;
import org.opencms.db.*;
import org.opencms.main.*;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2005</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class OpenCmsAuth
{
private CmsObject theCmsObject;
public OpenCmsAuth(HttpServletRequest req,
HttpServletResponse resp,
String userName, String password)
{
super();
try
{
FrontierLogUtil.logDebug("Creating CmsDefaultUsers");
CmsDefaultUsers theDefaultUsers = new CmsDefaultUsers();
FrontierLogUtil.logDebug("Getting guest username");
String theGuestUser = theDefaultUsers.getUserGuest();
FrontierLogUtil.logDebug ("theGuestUser = " + theGuestUser +
", userName = " +
userName + ", password = " + password);
CmsObject theObject = OpenCms.initCmsObject (theGuestUser);
String theLoggedInUser = theCmsObject.loginUser (userName,
password);
if (theLoggedInUser.equals(userName))
FrontierLogUtil.logDebug("User " + userName + " logged in");
else
FrontierLogUtil.logDebug("Login failed for user " + userName);
}
catch (CmsException ce)
{
System.err.println("Caught CmsException: " + ce.getMessage());
}
}
}
Again, I am trying to run this from another Web application on the
same Tomcat server to effect an automatic OpenCMS login. My guess is
that I am not accessing the OpenCMS application context properly.
Again, apologies and thanks. -- Bill Edwards
More information about the opencms-dev
mailing list