You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by imadhusudhanan <im...@zohocorp.com> on 2009/01/28 15:08:26 UTC

Failed Login Exception while using Windows WebFolder client ..

Dear All,

    I used cadaver client to connect to my webdav setup and it worked fine. The Authentication and authorization was working fine. When I switched to windows web folder I found that the workspace for any user logging is directed to the default workspace "default" and the not the workspace the user intended to see. Moreover my accessmanager doesnt allow the user to proceed further and it throws a FaliedLoginException (which I used in my code) to the user. This is only with Windows Web Folder Client. Are there any solutions earlier said .. ?? Pls help.

Regards,
MadhuSudhanan I.
www.zoho.com
'If you wanna walk quick Walk Alone, if you wanna walk far Walk Together ..."

Re: Re: Failed Login Exception while using Windows WebFolder client ..

Posted by Alexander Klimetschek <ak...@day.com>.
On Thu, Jan 29, 2009 at 2:45 PM, imadhusudhanan
<im...@zohocorp.com> wrote:
>     So may i know the url u gave,  /repository/<workspace-name>/<repo-path>)
> ??
>
>     What's the <repo-path> in this ??

It's the JCR path inside the workspace you want to address via webdav.
For the root folder it would be empty, ie. the whole string would be
/repository/<workspace-name>.

Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Re: Failed Login Exception while using Windows WebFolder client ..

Posted by imadhusudhanan <im...@zohocorp.com>.
HI,

    This is what I like to supply to the user ,
    
    Url supplied :: http://exampledomain.exampleserver.com/webdav/User_Name 

    My repository config file  ::   webapps/domain/wedav/repository.xml
    My repo Home dir     :: webapps/domain/webdav

    The above two will be used to get the repository instance thru JNDI look - up. And the JNDI look up code goes like this ..

    String configFile = "../webapps/domain/webdav/repository.xml";
            String repHomeDir = "../webapps/domain/webdav";
                        Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
                 env.put(Context.PROVIDER_URL, "localhost");
            InitialContext ctx = new InitialContext(env);
            RegistryHelper.registerRepository(ctx, "repo", configFile, repHomeDir, true);
                        Repository r = (Repository) ctx.lookup("repo");
                        
                        if(r != null) {
                SimpleCredentials cred = new SimpleCredentials(ADMIN_USER_ID, ADMIN_PASS.toCharArray());
                           Session session = r.login(cred, null);
                                JackrabbitWorkspace ws = (JackrabbitWorkspace)session.getWorkspace();
                javax.jcr.Node rn = session.getRootNode();
                                this.rootNode = rn;
                this.session = session;
                               this.repo = r;
                return r;
                       } else {
                System.out.println("Return null");
            }
              
    With this i get a repository created under webdav directory. 

    Also it was easy for me when I gave a workspace to one user so that when I map userX to workspace userX i can supply him the url http:// example_domain.com/webdav/userX 

    And when it goes to userY it is http://example_domain.com/webdav/userY and thats it JR will directly let the user in to the specified workspace defined by the name of the user. 

    So may i know the url u gave,  /repository/<workspace-name>/<repo-path>) ??

    What's the <repo-path> in this ?? Is that the /home/userX u have mentioned  ?? Do let me know I need provide further info .. Take care.
            

        


    
        

Regards,
MadhuSudhanan I.
www.zoho.com
'If you wanna walk quick Walk Alone, if you wanna walk far Walk Together ..."



---- On Thu, 29 Jan 2009 Alexander Klimetschek <ak...@day.com> wrote ---- 

 > Hi, 
 >  
 > in general I think it is much simpler to have nodes for each user in 
 > the main workspace (eg. /home/userX) than to create a new workspace 
 > for each user. I think that solution won't scale well. 
 >  
 > Regarding Windows web folders: AFAIK that one is buggy as hell and not 
 > so conformant to the spec. I would try a different webdav client tool 
 > for Windows. 
 >  
 > I looked at the code and I don't see any direct errors (see below for 
 > a comment). But I wonder how the login page interacts with the Webdav 
 > access? Is the user required to login first via a browser, then his 
 > workspace gets created if it doesn't exist yet and then he switches 
 > over to Webdav to do his work? Do you supply the username/workspace 
 > name in the webdav url (which by default is sth like 
 > /repository/<workspace-name>/<repo-path>)? 
 >  
 > On Thu, Jan 29, 2009 at 6:17 AM, imadhusudhanan 
 > <im...@zohocorp.com> wrote: 
 > >     String enableToUser = request.getParameter("user"); 
 > >     if(enableToUser != null && !enableToUser.equalsIgnoreCase("")) { 
 > >         WebDAVServlet webdavServlet = new WebDAVServlet(); 
 > >         Repository repoCreated = webdavServlet.getRepository(); 
 >  
 > Creating a new WebdavServlet every time only to get the repository 
 > from its configuration is overkill. You should rather use JNDI for 
 > that (or at least a global singleton). This could also be the reason 
 > for errors, but I don't know what happens in the internals of the 
 > webdavservlet code. 
 >  
 >  
 > Regards, 
 > Alex 
 >  
 > --  
 > Alexander Klimetschek 
 > alexander.klimetschek@day.com  

Re: Re: Failed Login Exception while using Windows WebFolder client ..

Posted by Alexander Klimetschek <ak...@day.com>.
Hi,

in general I think it is much simpler to have nodes for each user in
the main workspace (eg. /home/userX) than to create a new workspace
for each user. I think that solution won't scale well.

Regarding Windows web folders: AFAIK that one is buggy as hell and not
so conformant to the spec. I would try a different webdav client tool
for Windows.

I looked at the code and I don't see any direct errors (see below for
a comment). But I wonder how the login page interacts with the Webdav
access? Is the user required to login first via a browser, then his
workspace gets created if it doesn't exist yet and then he switches
over to Webdav to do his work? Do you supply the username/workspace
name in the webdav url (which by default is sth like
/repository/<workspace-name>/<repo-path>)?

On Thu, Jan 29, 2009 at 6:17 AM, imadhusudhanan
<im...@zohocorp.com> wrote:
>     String enableToUser = request.getParameter("user");
>     if(enableToUser != null && !enableToUser.equalsIgnoreCase("")) {
>         WebDAVServlet webdavServlet = new WebDAVServlet();
>         Repository repoCreated = webdavServlet.getRepository();

Creating a new WebdavServlet every time only to get the repository
from its configuration is overkill. You should rather use JNDI for
that (or at least a global singleton). This could also be the reason
for errors, but I don't know what happens in the internals of the
webdavservlet code.


Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Fwd: Re: Failed Login Exception while using Windows WebFolder client ..

Posted by imadhusudhanan <im...@zohocorp.com>.
  
  >  Dear Alex,
 > 
 > And here is the code in my jsp , it is the same code that I wrote when I instantiate a Repository during the server start - up. I provided a snap shot of the logging page. Should I provide any more info .. 
 > 
 > 
 > 
 > <%@page import="javax.servlet.http.HttpServletRequest"%>
 > <%@page import="javax.servlet.http.HttpServletResponse"%>
 > <%@page import="javax.servlet.ServletOutputStream"%>
 > <%@page import="javax.servlet.ServletInputStream"%>
 > <%@page import="javax.servlet.ServletException"%>
 > <%@page import="javax.jcr.*"%>
 > <%@page import="javax.jcr.query.*"%>
 > <%@page import="javax.jcr.version.*"%>
 > <%@page import="org.apache.jackrabbit.webdav.simple.SimpleWebdavServlet"%>
 > <%@page import="org.apache.jackrabbit.api.JackrabbitWorkspace"%>
 > <%@page import="org.apache.jackrabbit.core.*"%>
 > <%
 >     String enableToUser = request.getParameter("user");
 >     if(enableToUser != null && !enableToUser.equalsIgnoreCase("")) {
 >         WebDAVServlet webdavServlet = new WebDAVServlet();
 >         Repository repoCreated = webdavServlet.getRepository();
 >         //SimpleCredentials cred = new SimpleCredentials("docuser", "docuser".toCharArray());
 >         javax.jcr.Session sess = repoCreated.login();
 >         JackrabbitWorkspace ws = (JackrabbitWorkspace)sess.getWorkspace();
 >         String[] wsArray = ws.getAccessibleWorkspaceNames();
 >         boolean isUserExist = false;
 >         for(String wsOne : wsArray) {
 >             System.out.println("Accessible workspace in JSP >>> "+wsOne);
 >             if(!isUserExist) {
 >                 if(wsOne.equalsIgnoreCase(enableToUser.trim())) {
 >                     isUserExist = true;
 >                 } else {
 >                     continue;
 >                 }
 >             } else {
 >                  break;
 >             }
 >         }
 >         if(!isUserExist) {
 >             ws.createWorkspace(enableToUser); //create a workspace or a new file system in DFS
 >         } else {
 >             System.out.println("User Already Exist !!");
 >         }
 >     } else {
 >         System.out.println("Invalid User !!");
 >     }
 > %>
 > 
 > Regards,
 > MadhuSudhanan I.
 > http://zoho.com
 > 'If you wanna walk quick Walk Alone, if you wanna walk far Walk Together ..."
 > 
 > 
 > 
 > ---- On Wed, 28 Jan 2009 Alexander Klimetschek <ak...@day.com> wrote ---- 
 > 
 >  On Wed, Jan 28, 2009 at 3:08 PM, imadhusudhanan 
 > <im...@zohocorp.com> wrote: 
 > > I used cadaver client to connect to my webdav setup and it worked fine. 
 > > The Authentication and authorization was working fine. When I switched to 
 > > windows web folder I found that the workspace for any user logging is 
 > > directed to the default workspace "default" and the not the workspace the 
 > > user intended to see. Moreover my accessmanager doesnt allow the user to 
 > > proceed further and it throws a FaliedLoginException (which I used in my 
 > > code) to the user. This is only with Windows Web Folder Client. Are there 
 > > any solutions earlier said .. ?? Pls help. 
 > 
 > I guess you should provide some of your code and/or webdav logging, 
 > especially since the "create workspace for each user" functionality is 
 > written by you and we don't know at all how it works. 
 > 
 > Regards, 
 > Alex 
 > 
 > -- 
 > Alexander Klimetschek 
 > alexander.klimetschek@day.com

Re: Failed Login Exception while using Windows WebFolder client ..

Posted by Alexander Klimetschek <ak...@day.com>.
On Wed, Jan 28, 2009 at 3:08 PM, imadhusudhanan
<im...@zohocorp.com> wrote:
>     I used cadaver client to connect to my webdav setup and it worked fine.
> The Authentication and authorization was working fine. When I switched to
> windows web folder I found that the workspace for any user logging is
> directed to the default workspace "default" and the not the workspace the
> user intended to see. Moreover my accessmanager doesnt allow the user to
> proceed further and it throws a FaliedLoginException (which I used in my
> code) to the user. This is only with Windows Web Folder Client. Are there
> any solutions earlier said .. ?? Pls help.

I guess you should provide some of your code and/or webdav logging,
especially since the "create workspace for each user" functionality is
written by you and we don't know at all how it works.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com