From: Brett Porter Date: Sat, 19 Apr 2008 03:15:06 +0000 (+0000) Subject: [MRM-781] correct probem with guest account X-Git-Tag: archiva-r676265~174 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c2c71dd5ec06f1414decfaf588688d6b58a704a8;p=archiva.git [MRM-781] correct probem with guest account Submitted by: James William Dumay git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@649748 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java index fb4d2e3c4..48ba64ba1 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java @@ -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); } diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavSessionProvider.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavSessionProvider.java index 766426105..c0ed7bc5c 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavSessionProvider.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavSessionProvider.java @@ -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 )