}
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);
}
// 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 )
",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 )