You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Christanto (Created) (JIRA)" <ji...@apache.org> on 2011/12/08 11:04:39 UTC

[jira] [Created] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
-------------------------------------------------------------------------------------------------------------------

                 Key: SLING-2325
                 URL: https://issues.apache.org/jira/browse/SLING-2325
             Project: Sling
          Issue Type: Bug
          Components: JCR
    Affects Versions: JCR DavEx 1.0.0
            Reporter: Christanto
            Priority: Blocker


SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>

Code excerpt from SlingDavExServlet:

final Session session = resolver.adaptTo(Session.class);
// as the session might be longer used by davex than the request
// we have to create a new session!
if ( session != null ) {
    final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
    final Session newSession = session.impersonate(credentials);
    return newSession;
}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Carsten Ziegeler (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13187678#comment-13187678 ] 

Carsten Ziegeler commented on SLING-2325:
-----------------------------------------

LGTM
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Justin Edelson
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Felix Meschberger (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13192173#comment-13192173 ] 

Felix Meschberger commented on SLING-2325:
------------------------------------------

I have inspected the JCR Remoting code and actually only found two cases where sessions are cached beyond the request: LOCK (mainly locking) and SUBSCRIBE (observation).

So, the solution would probably be:

   if it is a LOCK or SUBSCRIBE request
       -> create admin
       -> impersonate as user setting credential/session attribute
   else
       -> return request session

The release method would check for the special impersonation attribute and only logout such sessions and leave other sessions alone.
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Justin Edelson
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Justin Edelson (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Justin Edelson resolved SLING-2325.
-----------------------------------

    Resolution: Fixed

using new functionality added in SLING-2337

fixed in r1221546
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Justin Edelson
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Felix Meschberger (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13187601#comment-13187601 ] 

Felix Meschberger edited comment on SLING-2325 at 1/17/12 12:05 PM:
--------------------------------------------------------------------

Potential solutions:

 * Fix Jackrabbit DavEx
 * Grante Impersonation privilege to self to all users
 * Use a temporary admin session to impersonate as the target user (thanks Carsten Ziegeler)

So we could do this:

final Session session = resolver.adaptTo(Session.class); 
if ( session != null ) { 
    final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW); 
    try {
       final Session newSession = session.impersonate(credentials); 
       return newSession; 
    } catch (RepositoryException re) {
      final Session adminSession = slingRepository.loginAdministrative(session.getWorkspace().getName());
      try {
         return adminSession.impersonate(credentials);
      } finally {
         adminSession.logout();
      }
   }
}
                
      was (Author: fmeschbe):
    Potential solutions:

 * Fix Jackrabbit DavEx
 * Grante Impersonation privilege to self to all users
 * Use a temporary admin session to impersonate as the target user (thanks Carsten Ziegeler)

So we could do this:

final Session session = resolver.adaptTo(Session.class); 
if ( session != null ) { 
    final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW); 
    try {
       final Session newSession = session.impersonate(credentials); 
       return newSession; 
    } catch (RepositoryException re) {
      final Session adminSession = slingRepository.loginAdministrative(session.getWorkspace().getName());
      return adminSession.impersonate(credentials);
   }
}
                  
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Justin Edelson
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Justin Edelson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13192517#comment-13192517 ] 

Justin Edelson commented on SLING-2325:
---------------------------------------

OK, I'll cry uncle.... and give up on having support for long lived sessions in the framework.

But, this solution now seems too fragile. I'd rather we did the admin impersonate trick all the time. I'd hate for an implementation change on the JR side to cause this to break again.

WDYT?
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Felix Meschberger
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Justin Edelson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13184989#comment-13184989 ] 

Justin Edelson commented on SLING-2325:
---------------------------------------

IIUC, we can't close the session when using DavEx because DavEx needs an open session to handle ObservationListeners. You can see this yourself in the Sling IT test suite: don't set this attribute and we have test failures.
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Justin Edelson
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Felix Meschberger (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13187601#comment-13187601 ] 

Felix Meschberger commented on SLING-2325:
------------------------------------------

Potential solutions:

 * Fix Jackrabbit DavEx
 * Grante Impersonation privilege to self to all users
 * Use a temporary admin session to impersonate as the target user (thanks Carsten Ziegeler)

So we could do this:

final Session session = resolver.adaptTo(Session.class); 
if ( session != null ) { 
    final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW); 
    try {
       final Session newSession = session.impersonate(credentials); 
       return newSession; 
    } catch (RepositoryException re) {
      final Session adminSession = slingRepository.loginAdministrative(session.getWorkspace().getName());
      return adminSession.impersonate(credentials);
   }
}
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Justin Edelson
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Justin Edelson (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Justin Edelson updated SLING-2325:
----------------------------------

    Fix Version/s: JCR DavEx 1.1.0
         Assignee: Justin Edelson
    
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Justin Edelson
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Felix Meschberger (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13192193#comment-13192193 ] 

Felix Meschberger commented on SLING-2325:
------------------------------------------

Implemented this proposal in Rev. 1235287

Going to do further tests...
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Justin Edelson
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Felix Meschberger (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-2325.
--------------------------------------

    Resolution: Fixed
      Assignee: Felix Meschberger  (was: Justin Edelson)

Did some code cleanup and ensured temporary admin session is logged out after use in Rev. 1235447
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Felix Meschberger
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Felix Meschberger (Reopened) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reopened SLING-2325:
--------------------------------------


As noted with SLING-2337: The solution to just force the session to remain open is IMHO wrong. The correct solution would be to ensure Jackrabbit WebDAV is really letting go of sessions after having processed the request.
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Justin Edelson
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Felix Meschberger (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13192637#comment-13192637 ] 

Felix Meschberger commented on SLING-2325:
------------------------------------------

> and give up on having support for long lived sessions in the framework

You can have long lived sessions but not the ones created through the authentication mechanism. 

> I'd hate for an implementation change on the JR side to cause this to break again. 

Right. On the other hand, we include the exact portion of the code against which we do the thing in the bundle.

But ok, maybe it really is better to always to this... will do

                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Felix Meschberger
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Jukka Zitting (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13189242#comment-13189242 ] 

Jukka Zitting commented on SLING-2325:
--------------------------------------

Is it possible to keep the original login credentials around for example as a request attribute? Then you could simply do a repository.login() with those credentials to get a new session for the already logged-in user.
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Justin Edelson
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Felix Meschberger (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13192645#comment-13192645 ] 

Felix Meschberger commented on SLING-2325:
------------------------------------------

Changed implementation such that a session is always created using an admin session in Rev. 1235543
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Felix Meschberger
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Justin Edelson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13188514#comment-13188514 ] 

Justin Edelson commented on SLING-2325:
---------------------------------------

I'm not sure I agree that there's anything to "fix" in the DavEx servlet. It's inherently stateful, at minimum due to Observation.

Granting everyone the ability to impersonate themselves seems reasonable to me, but I haven't had a chance to validate if that's acceptable under JSR-170/283. In any case, that should be a Jackrabbit bug.

The temporary admin session will obviously work, but it looks very much like using exceptions as control flow. If there was some notion that eventually self impersonation would always be allowed, I'd be OK with this as a temporary solution, but I'd prefer not to have this code in Sling long term.
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Justin Edelson
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SLING-2325) SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.

Posted by "Felix Meschberger (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13189786#comment-13189786 ] 

Felix Meschberger commented on SLING-2325:
------------------------------------------

No, login credentials are temporary and dropped (for obvious reasons)
                
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-2325
>                 URL: https://issues.apache.org/jira/browse/SLING-2325
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR DavEx 1.0.0
>            Reporter: Christanto
>            Assignee: Justin Edelson
>            Priority: Blocker
>              Labels: davex
>             Fix For: JCR DavEx 1.1.0
>
>
> SlingDavExServlet uses impersonation to get session. Doesn't work nicely if user doesn't have right to impersonate.
> LoginException will be thrown: javax.jcr.LoginException: attempt to impersonate denied for <user>
> Code excerpt from SlingDavExServlet:
> final Session session = resolver.adaptTo(Session.class);
> // as the session might be longer used by davex than the request
> // we have to create a new session!
> if ( session != null ) {
>     final Credentials credentials = new SimpleCredentials(session.getUserID(), EMPTY_PW);
>     final Session newSession = session.impersonate(credentials);
>     return newSession;
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira