ozeigermann    2005/02/09 11:11:56

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        AbstractWebdavMethod.java
               src/webdav/server/org/apache/slide/webdav/util
                        WebdavUtils.java
  Log:
  Added means to force client (re-)authentication when UnauthenticatedException 
hits the WebDAV layer
  
  Revision  Changes    Path
  1.74      +11 -3     
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java
  
  Index: AbstractWebdavMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- AbstractWebdavMethod.java 19 Jan 2005 17:33:11 -0000      1.73
  +++ AbstractWebdavMethod.java 9 Feb 2005 19:11:56 -0000       1.74
  @@ -450,6 +450,14 @@
               // is already set.
           } catch (SlideException ex) {
               int statusCode = getErrorCode( ex );
  +            if (statusCode == WebdavStatus.SC_UNAUTHORIZED) {
  +                // This means the user is required to authenticate 
(correctly),
  +                // so add the specific header and invalidate session to force
  +                // new authentication
  +                resp.setHeader("WWW-Authenticate",
  +                        "Basic realm=\"DAV\"");
  +                req.getSession().invalidate();
  +            }
               sendError( statusCode, ex );
               // do not throw exception as the response code has already been 
set, 
               // otherwise the servlet will log this as an error and issue a 
stack trace
  
  
  
  1.35      +7 -4      
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/WebdavUtils.java
  
  Index: WebdavUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/WebdavUtils.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- WebdavUtils.java  2 Feb 2005 04:57:59 -0000       1.34
  +++ WebdavUtils.java  9 Feb 2005 19:11:56 -0000       1.35
  @@ -48,6 +48,7 @@
   import org.apache.slide.macro.ConflictException;
   import org.apache.slide.macro.ForbiddenException;
   import org.apache.slide.security.AccessDeniedException;
  +import org.apache.slide.security.UnauthenticatedException;
   import org.apache.slide.structure.ObjectAlreadyExistsException;
   import org.apache.slide.structure.ObjectNotFoundException;
   import org.apache.slide.util.Configuration;
  @@ -541,6 +542,8 @@
               return WebdavStatus.SC_FORBIDDEN;
           } catch(AccessDeniedException e) {
               return WebdavStatus.SC_FORBIDDEN;
  +        } catch(UnauthenticatedException e) {
  +            return WebdavStatus.SC_UNAUTHORIZED;
           } catch(ObjectAlreadyExistsException e) {
               return WebdavStatus.SC_PRECONDITION_FAILED;
           } catch(ServiceAccessException e) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to