Hi,<br><br>we're using Struts 2 within OpenCMS and want to login our users into OpenCMS via an action.<br>Login seems to work but is not persisted (no OpenCMS session is created).<br><br>Here's the relevant part of the login action:<br>
<br> CmsObject tInitCmsObject = OpenCms.initCmsObject( OpenCms.getDefaultUsers().getUserGuest() );<br> <br> if( tInitCmsObject != null )<br> {<br> String tLoggedInUserName;<br><br> tLoggedInUserName = tInitCmsObject.loginUser( username, password );<br>
System.out.println( "Logged in user " + tLoggedInUserName );<br> <br> if(tInitCmsObject.getRequestContext().currentUser().isGuestUser())<br> {<br> System.out.println("Login failed - still guest user");<br>
}<br> <br> HttpSession tSession = ServletActionContext.getRequest().getSession( true );<br> <br> if (project != null)<br> {<br> // if this fails, the login is regarded as a failure as well<br>
CmsProject tProject = tInitCmsObject.readProject(project);<br> tInitCmsObject.getRequestContext().setCurrentProject(tProject);<br> tInitCmsObject.getRequestContext().setSiteRoot( siteRoot );<br>
}<br> }<br><br>The output (only the line "Logged in user ..." is printed) suggests that login succeeded.<br>However, if I now want to access a secured page (the permissions are set correctly) it doesn't work.<br>
Checking for sessions in the session manager reveals that there's no session.<br><br>Any ideas?<br><br>Thanks in advance,<br><br>Thomas<br>