[opencms-dev] how to handle webuser login?

Siegfried Puchbauer siegfried.puchbauer at gmail.com
Fri Jul 7 16:52:19 CEST 2006


There is also a property called "login-form" where you can put in the uri of
a login form (eg /login/). You can set this property eg. in the root folder
of a site and the subfolders inherit it.
When you hit a protected resource, opencms redirect you to this login form.
The login form receives  GET Parameters like:
/login/?__loginform=true&requestedResource=%2Frestricted_area%2Fsubfolder%2F

All you have to implement is a form (which also forwards the parameters) and
a login handler page like:

<%@ page session="true" import="org.opencms.jsp.*" %><%
CmsJspLoginBean cms = new CmsJspLoginBean(pageContext, request, response);
org.opencms.file.CmsObject obj = cms.getCmsObject();
String requestedPage= request.getParameter("requestedResource");

        try{
            obj.loginWebUser(request.getParameter("login_username"),
request.getParameter("login_password"));
            response.sendRedirect(cms.link(requestedPage));
        }catch(org.opencms.main.CmsException e){
            response.sendRedirect(cms.link(cms.property("login-form",
"search")) + "?message=" + e.getLocalizedMessage(java.util.Locale.GERMAN));
        }
%>

This way its very easy to replace the default browser auth-popup with a html
form

hth

sigi

On 7/7/06, Roman Uhlig <roman.uhlig at knve.de> wrote:
>
>
> Just a side note to Christian's post:
>
> For logging in webusers, we are not using the OpenCms API directly, but
> just
> setting folder permissions for the restricted areas within the OpenCms
> workplace. This automatically raises Tomcat (or whatever)
> http-Authentication. This isn't pure beauty, but works fast and without
> additional work. Of course you may request user information via the
> OpenCms
> API as usual.
>
> Roman
> --
> View this message in context:
> http://www.nabble.com/how-to-handle-webuser-login--tf1894839.html#a5213708
> Sent from the OpenCMS - Dev forum at Nabble.com.
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>



-- 
Mit freundlichen Grüßen

Siegfried Puchbauer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060707/9cd04ff4/attachment.htm>


More information about the opencms-dev mailing list