ozeigermann    2005/02/10 09:26:57

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        AbstractWebdavMethod.java
               src/conf/webapp web.xml
               src/webdav/server/org/apache/slide/webdav
                        WebdavServletConfig.java
  Log:
  Made authentication header that is set when the need for reauthentication is 
indicated by UnauthenticatedException
  configurable in web.xml
  
  Revision  Changes    Path
  1.75      +5 -5      
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.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- AbstractWebdavMethod.java 9 Feb 2005 19:11:56 -0000       1.74
  +++ AbstractWebdavMethod.java 10 Feb 2005 17:26:57 -0000      1.75
  @@ -454,8 +454,8 @@
                   // 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\"");
  +                String authentication = config.getAuthenticationHeader();
  +                resp.setHeader("WWW-Authenticate", authentication);
                   req.getSession().invalidate();
               }
               sendError( statusCode, ex );
  
  
  
  1.36      +9 -0      jakarta-slide/src/conf/webapp/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/conf/webapp/web.xml,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- web.xml   9 Feb 2005 19:14:38 -0000       1.35
  +++ web.xml   10 Feb 2005 17:26:57 -0000      1.36
  @@ -228,6 +228,15 @@
                   information.
               </description>
           </init-param-->
  +        <!--init-param>
  +            <param-name>authentication-header</param-name>
  +            <param-value>Basic realm="Slide DAV Server"</param-value>
  +            <description>
  +                This parameter allows you to configure the authentication
  +                header that is set when Slide asks the client for
  +                (re-)authentication. 
  +            </description>
  +        </init-param-->
           <load-on-startup>1</load-on-startup>
           <!-- Uncomment this to get authentication -->
           <@[EMAIL PROTECTED]>
  
  
  
  1.15      +26 -3     
jakarta-slide/src/webdav/server/org/apache/slide/webdav/WebdavServletConfig.java
  
  Index: WebdavServletConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/WebdavServletConfig.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- WebdavServletConfig.java  15 Dec 2004 18:02:59 -0000      1.14
  +++ WebdavServletConfig.java  10 Feb 2005 17:26:57 -0000      1.15
  @@ -71,6 +71,13 @@
       
       static final String LOCKDISCOVERY_INCL_PRINCIPAL =
           "lockdiscoveryIncludesPrincipalURL";
  +
  +    static final String AUTHENTICATION_HEADER =
  +        "authentication-header";
  +
  +    static final String AUTHENTICATION_HEADER_DEFAULT =
  +        "Basic realm=\"Slide DAV Server\"";
  +
       // ----------------------------------------------------- Instance 
Variables
       
       
  @@ -126,6 +133,8 @@
       
       protected boolean lockdiscoveryIncludesPrincipalURL = false;
       
  +    protected String authenticationHeader = AUTHENTICATION_HEADER_DEFAULT;
  +    
       // ----------------------------------------------------------- 
Construction
       
       
  @@ -191,6 +200,11 @@
               lockdiscoveryIncludesPrincipalURL 
=!("false".equalsIgnoreCase(value));
           }
           
  +        value = getInitParameter(AUTHENTICATION_HEADER);
  +        if (value != null) {
  +            authenticationHeader = value;
  +        }
  +        
           // read external reports parameter
           try {
               XMLValue xv = new XMLValue(getInitParameter("external-reports"));
  @@ -349,5 +363,14 @@
       public boolean lockdiscoveryIncludesPrincipalURL() {
           return lockdiscoveryIncludesPrincipalURL;
       }
  +    
  +    /**
  +     * Returns the value of the authentication header when 
(re-)authentication is required by
  +     * throwing the [EMAIL PROTECTED] 
org.apache.slide.security.UnauthenticatedException}.
  +     * 
  +     */
  +    public String getAuthenticationHeader() {
  +        return authenticationHeader;
  +    }
   }
   
  
  
  

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

Reply via email to