]> source.dussan.org Git - archiva.git/commitdiff
[MRM-781] correct probem with guest account
authorBrett Porter <brett@apache.org>
Sat, 19 Apr 2008 03:15:06 +0000 (03:15 +0000)
committerBrett Porter <brett@apache.org>
Sat, 19 Apr 2008 03:15:06 +0000 (03:15 +0000)
Submitted by: James William Dumay

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@649748 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavSessionProvider.java

index fb4d2e3c44292c9266d230da776370d3743f9e69..48ba64ba1b714fb151850124162fe1c1a7708a8b 100644 (file)
@@ -121,7 +121,9 @@ public class RepositoryServlet
         }
         catch (DavException e) {
             if (e.getErrorCode() == HttpServletResponse.SC_UNAUTHORIZED) {
-                log.error("Should throw UnauthorizedDavException");
+                final String msg = "Should throw " + UnauthorizedDavException.class.getName();
+                log.error(msg);
+                webdavResponse.sendError(e.getErrorCode(), msg);
             } else {
                 webdavResponse.sendError(e);
             }
index 766426105c6b05fb283ef5777804355e707181bc..c0ed7bc5cf2c2abaff37acaab27b2de0990c14fe 100644 (file)
@@ -77,12 +77,11 @@ public class ArchivaDavSessionProvider implements DavSessionProvider
         // Authentication Tests.
         try
         {
-            AuthenticationResult result = httpAuth.getAuthenticationResult(request, null);
+            AuthenticationResult result = httpAuth.getAuthenticationResult( request, null );
 
-            if ( result == null || !result.isAuthenticated() )
+            if ( result != null && !result.isAuthenticated() )
             {
-                //Unfortunatly, the DavSessionProvider does not pass in the response
-                httpAuth.authenticate(request, null);
+                throw new UnauthorizedDavException(repositoryId, "User Credentials Invalid");
             }
         }
         catch ( AuthenticationException e )
@@ -130,7 +129,7 @@ public class ArchivaDavSessionProvider implements DavSessionProvider
                         ",permission=" + permission + ",repo=" + repositoryId + "] : " +
                         authzResult.getException().getMessage() );
                 }
-                throw new DavException(HttpServletResponse.SC_UNAUTHORIZED, "Access denied for repository " + repositoryId);
+                throw new UnauthorizedDavException(repositoryId, "Access denied for repository " + repositoryId);
             }
         }
         catch ( AuthorizationException e )