diff --git a/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo index 0f371f824..08e2b8c2a 100644 --- a/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo @@ -273,6 +273,22 @@ The URL for this repository. + + + username + 1.0.0+ + String + + The Username for this repository. + + + + password + 1.0.0+ + String + + The Password for this repository. + diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java index dc29d542f..a0149d727 100644 --- a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java +++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaRepository.java @@ -28,7 +28,7 @@ package org.apache.maven.archiva.model; public class ArchivaRepository { private ArchivaRepositoryModel model; - + private RepositoryURL url; protected boolean blacklisted; @@ -77,6 +77,16 @@ public class ArchivaRepository { return this.url; } + + public void setUsername(String username) + { + this.model.setRepositoryUsername(username); + } + + public void setPassword(String password) + { + this.model.setRepositoryPassword(password); + } public ArchivaRepositoryModel getModel() { @@ -102,6 +112,16 @@ public class ArchivaRepository { return this.model.getName(); } + + public String getUsername() + { + return model.getRepositoryUsername(); + } + + public String getPassword() + { + return model.getRepositoryPassword(); + } public String toString() { diff --git a/archiva-base/archiva-model/src/main/mdo/archiva-base.xml b/archiva-base/archiva-model/src/main/mdo/archiva-base.xml index 859747925..a2b13a15d 100644 --- a/archiva-base/archiva-model/src/main/mdo/archiva-base.xml +++ b/archiva-base/archiva-model/src/main/mdo/archiva-base.xml @@ -132,6 +132,24 @@ The URL of the repository. + + repositoryUsername + false + 1.0.0+ + String + + The Username of the repository. + + + + repositoryPassword + false + 1.0.0+ + String + + The Password of the repository. + + creationSource false diff --git a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java index 96117c89f..283c86907 100644 --- a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java @@ -45,6 +45,7 @@ import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.Wagon; import org.apache.maven.wagon.WagonException; import org.apache.maven.wagon.authentication.AuthenticationException; +import org.apache.maven.wagon.authentication.AuthenticationInfo; import org.apache.maven.wagon.proxy.ProxyInfo; import org.apache.maven.wagon.repository.Repository; import org.codehaus.plexus.logging.AbstractLogEnabled; @@ -441,7 +442,8 @@ public class DefaultRepositoryProxyConnectors transferChecksum( wagon, remoteRepository, remotePath, localFile, ".sha1" ); transferChecksum( wagon, remoteRepository, remotePath, localFile, ".md5" ); - } + + } } catch ( ResourceDoesNotExistException e ) { @@ -691,15 +693,31 @@ public class DefaultRepositoryProxyConnectors try { + AuthenticationInfo authInfo = null; + String username = remoteRepository.getUsername(); + String password = remoteRepository.getPassword(); + if (username != null && password != null) + { + getLogger().info("Using username " + username + " to connect to remote repository " + + remoteRepository.getUrl()); + authInfo = new AuthenticationInfo(); + authInfo.setUserName(username); + authInfo.setPassword(password); + } + else + { + getLogger().info("No authentication for remote repository needed"); + } + Repository wagonRepository = new Repository( remoteRepository.getId(), remoteRepository.getUrl().toString() ); if ( networkProxy != null ) { - wagon.connect( wagonRepository, networkProxy ); + wagon.connect( wagonRepository, authInfo, networkProxy ); } else { - wagon.connect( wagonRepository ); + wagon.connect( wagonRepository, authInfo ); } connected = true; } @@ -871,6 +889,8 @@ public class DefaultRepositoryProxyConnectors ArchivaRepository repo = new ArchivaRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getUrl() ); repo.getModel().setLayoutName( repoConfig.getLayout() ); + repo.setUsername(repoConfig.getUsername()); + repo.setPassword(repoConfig.getPassword()); return repo; } diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRemoteRepository.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRemoteRepository.jsp index d61bd2e1b..d1455abf8 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRemoteRepository.jsp +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRemoteRepository.jsp @@ -21,18 +21,16 @@ - Admin: Add Repository + Admin: Add Remote Repository -

Admin: Add Repository

+

Admin: Add Remote Repository

-

Add Repository

- diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp index 93f8c622c..98a050a05 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addRepository.jsp @@ -21,18 +21,16 @@ - Admin: Add Repository + Admin: Add Managed Repository -

Admin: Add Repository

+

Admin: Add Managed Repository

-

Add Repository

- diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp index 6fefba1dd..3f6686c57 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp @@ -21,20 +21,18 @@ - Admin: Edit Repository + Admin: Edit Remote Repository -

Admin: Edit Repository

+

Admin: Edit Remote Repository

-

Edit Repository

- diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp index 8d1d2fa1f..8735f1d2e 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRepository.jsp @@ -21,20 +21,18 @@ - Admin: Edit Repository + Admin: Edit Managed Repository -

Admin: Edit Repository

+

Admin: Edit Managed Repository

-

Edit Repository

- diff --git a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/remoteRepositoryForm.jspf b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/remoteRepositoryForm.jspf index d5316de8e..eaaac6237 100644 --- a/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/remoteRepositoryForm.jspf +++ b/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/remoteRepositoryForm.jspf @@ -21,5 +21,7 @@ + +