[opencms-dev] Keeping Authentication while Rewriting URLs
Mekonnen, Daniel
dmekonnen at progeny.net
Thu Feb 17 01:42:54 CET 2005
Greetings,
I'm using mod_rewrite and mod_jk to mask the /opencms/opencms/mysite
prefix in URLs but later lose user authentication settings. Using a
basic authentication code:
CmsJspActionElement cmsJsp = new CmsJspActionElement(pageContext,
request, response);
CmsObject cms = cmsjsp.getCmsObject();
String username = request.getParameter("username");
String password = request.getParameter("password");
:
cms.loginWebUser(username, password);
CmsUser user = cms.getRequestContext().currentUser();
//out.println("You are logged in as "+cmsJsp.user("name"));
response.sendRedirect("/Home/index.html");
I will see that the correct user name is known here by uncommenting the
out.println. In the template for "/Home/index.html" displaying the
cmsJsp.user("name") again, it becomes "Guest". If however the
sendRedirect is to the relative "Home/index.html", allowing
/opencms/opencms/mysite expansion to creep back in, then, the correct
username will be displayed.
Authentication appears to be tied to the page URL. Can the URL be reset
in the page context or request somehow such that the authentication is
not lost? Or should a completely different approach be used here?
thank you,
Daniel
Setup Info:
OpenCMS 5.0.1 "fat"
Tomcat 5.0
Apache 2.0.52
mod_jk 1.2.6
Linux Fedora Core 3
Java 1.4.2_06
mod_rewrite and mod_jk rules:
RewriteRule !^/opencms/opencms/mysite/(.*)$
/opencms/opencms/mysite/%2%{REQUEST_URI} [PT]
JkMount /* worker1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050216/19cbe454/attachment.htm>
More information about the opencms-dev
mailing list