Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback to find credential with a null/blank realm #36

Merged
merged 4 commits into from
Feb 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
# Use Docker-based container (instead of OpenVZ)
sudo: false

# https://blog.travis-ci.com/2017-07-11-trusty-as-default-linux-is-coming
# Travis now defaults to Trusty, which is missing openjdk6.
dist: precise

cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt/boot

# WORKAROUND https://github.com/travis-ci/travis-ci/issues/5227
addons:
hosts: workaround-travis-ci-issue-5227
hostname: workaround-travis-ci-issue-5227
apt:
sources:
- ubuntu-toolchain-r-test
Expand All @@ -22,9 +7,13 @@ addons:
- ant-optional

language: java
jdk:
- openjdk6
jdk: openjdk8

before_cache:
- find $HOME/.ivy2 -name "ivydata-*.properties" -print -delete
- find $HOME/.sbt -name "*.lock" -print -delete

cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt/boot
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
You can override this property to use one of the mirrors listed on
http://docs.codehaus.org/display/MAVENUSER/Mirrors+Repositories
-->
<property name="ibiblio-maven2-root" value="http://repo1.maven.org/maven2/" override="false" />
<property name="ibiblio-maven2-root" value="https://repo1.maven.org/maven2/" override="false" />

<namespaces>
<namespace name="maven2">
Expand Down
2 changes: 1 addition & 1 deletion src/example/dual/project/src/example/Hello.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void main(String[] args) throws Exception {
+ " : " + WordUtils.capitalizeFully(message));

HttpClient client = new HttpClient();
HeadMethod head = new HeadMethod("http://www.ibiblio.org/");
HeadMethod head = new HeadMethod("https://www.ibiblio.org/");
client.executeMethod(head);

int status = head.getStatusCode();
Expand Down
2 changes: 1 addition & 1 deletion src/example/go-ivy/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<echo message="installing ivy..."/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# * specific language governing permissions and limitations
# * under the License.
# ***************************************************************
ivy.ibiblio.default.artifact.root = http://www.ibiblio.org/maven/
ivy.ibiblio.default.artifact.root = https://www.ibiblio.org/maven/
ivy.ibiblio.default.artifact.pattern = [module]/[type]s/[artifact]-[revision].[ext]

ivy.ivyrep.default.ivy.pattern = [organisation]/[module]/ivy-[revision].xml
Expand Down
4 changes: 2 additions & 2 deletions src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public class IBiblioResolver extends URLResolver {

public static final String DEFAULT_PATTERN = "[module]/[type]s/[artifact]-[revision].[ext]";

public static final String DEFAULT_ROOT = "http://www.ibiblio.org/maven/";
public static final String DEFAULT_M2_ROOT = "http://repo1.maven.org/maven2/";
public static final String DEFAULT_ROOT = "https://www.ibiblio.org/maven/";
public static final String DEFAULT_M2_ROOT = "https://repo1.maven.org/maven2/";

private String root = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<xsl:param name="restricted"/>
<xsl:param name="quiet"/>

<xsl:variable name="maven2repo" select="'http://repo1.maven.org/maven2/'"/>
<xsl:variable name="maven2repo" select="'https://repo1.maven.org/maven2/'"/>

<xsl:template match="/packager-module">
<xsl:comment> GENERATED FILE - DO NOT EDIT </xsl:comment>
Expand Down
7 changes: 7 additions & 0 deletions src/java/org/apache/ivy/util/url/IvyAuthenticator.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ protected PasswordAuthentication getPasswordAuthentication() {
Message.debug("authentication: k='"
+ Credentials.buildKey(getRequestingPrompt(), getRequestingHost()) + "' c='" + c
+ "'");

// sbt change, driven by https://github.com/sbt/sbt/issues/2366
if (c == null) {
c = CredentialsStore.INSTANCE.getCredentials(null, getRequestingHost());
Message.debug("authentication: k='"
+ Credentials.buildKey(null, getRequestingHost()) + "' c='" + c + "'");
}
if (c != null) {
final String password = c.getPasswd() == null ? "" : c.getPasswd();
result = new PasswordAuthentication(c.getUserName(), password.toCharArray());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void setUp() throws Exception {
resolver2 = new IBiblioResolver();
resolver2.setName("maven2");
settings.setVariable("ivy.ibiblio.default.artifact.root",
"http://repo1.maven.org/maven2/");
"https://repo1.maven.org/maven2/");
settings.setVariable("ivy.ibiblio.default.artifact.pattern",
"[organisation]/[module]/[revision]/[artifact]-[revision].[ext]");
resolver2.setSettings(settings);
Expand Down
93 changes: 0 additions & 93 deletions test/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoaderTest.java

This file was deleted.

This file was deleted.

8 changes: 4 additions & 4 deletions test/java/org/apache/ivy/plugins/resolver/IBiblioHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public class IBiblioHelper {

public static String getIBiblioMirror() throws Exception {
if (!_checked) {
String[] mirrors = new String[] {"http://repo1.maven.org/maven/REPOSITORY-V1.txt",
"http://www.ibiblio.org/maven"};
String[] mirrorsRoot = new String[] {"http://repo1.maven.org/maven",
"http://www.ibiblio.org/maven"};
String[] mirrors = new String[] {"https://repo1.maven.org/maven/REPOSITORY-V1.txt",
"https://www.ibiblio.org/maven"};
String[] mirrorsRoot = new String[] {"https://repo1.maven.org/maven",
"https://www.ibiblio.org/maven"};

long best = -1;
for (int i = 0; i < mirrors.length; i++) {
Expand Down
20 changes: 10 additions & 10 deletions test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,38 +84,38 @@ protected void tearDown() throws Exception {
public void testDefaults() {
IBiblioResolver resolver = new IBiblioResolver();
_settings.setVariable("ivy.ibiblio.default.artifact.root",
"http://www.ibiblio.org/mymaven/");
"https://www.ibiblio.org/mymaven/");
_settings.setVariable("ivy.ibiblio.default.artifact.pattern",
"[module]/jars/[artifact]-[revision].jar");
resolver.setSettings(_settings);
List l = resolver.getArtifactPatterns();
assertNotNull(l);
assertEquals(1, l.size());
assertEquals("http://www.ibiblio.org/mymaven/[module]/jars/[artifact]-[revision].jar", l
assertEquals("https://www.ibiblio.org/mymaven/[module]/jars/[artifact]-[revision].jar", l
.get(0));
}

public void testInitFromConf() throws Exception {
_settings.setVariable("ivy.ibiblio.default.artifact.root", "http://www.ibiblio.org/maven/");
_settings.setVariable("ivy.ibiblio.default.artifact.root", "https://www.ibiblio.org/maven/");
_settings.setVariable("ivy.ibiblio.default.artifact.pattern",
"[module]/jars/[artifact]-[revision].jar");
_settings.setVariable("my.ibiblio.root", "http://www.ibiblio.org/mymaven/");
_settings.setVariable("my.ibiblio.root", "https://www.ibiblio.org/mymaven/");
_settings.setVariable("my.ibiblio.pattern", "[module]/[artifact]-[revision].jar");
_settings.load(IBiblioResolverTest.class.getResource("ibiblioresolverconf.xml"));
IBiblioResolver resolver = (IBiblioResolver) _settings.getResolver("ibiblioA");
assertNotNull(resolver);
List l = resolver.getArtifactPatterns();
assertNotNull(l);
assertEquals(1, l.size());
assertEquals("http://www.ibiblio.org/mymaven/[module]/[artifact]-[revision].jar", l.get(0));
assertEquals("https://www.ibiblio.org/mymaven/[module]/[artifact]-[revision].jar", l.get(0));

resolver = (IBiblioResolver) _settings.getResolver("ibiblioB");
assertNotNull(resolver);
l = resolver.getArtifactPatterns();
assertNotNull(l);
assertEquals(1, l.size());
assertEquals(
"http://www.ibiblio.org/mymaven/[organisation]/jars/[artifact]-[revision].jar", l
"https://www.ibiblio.org/mymaven/[organisation]/jars/[artifact]-[revision].jar", l
.get(0));

resolver = (IBiblioResolver) _settings.getResolver("ibiblioC");
Expand All @@ -125,7 +125,7 @@ public void testInitFromConf() throws Exception {
assertNotNull(l);
assertEquals(1, l.size());
assertEquals(
"http://repo1.maven.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]",
"https://repo1.maven.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]",
l.get(0));

resolver = (IBiblioResolver) _settings.getResolver("ibiblioD");
Expand All @@ -134,7 +134,7 @@ public void testInitFromConf() throws Exception {
l = resolver.getArtifactPatterns();
assertNotNull(l);
assertEquals(1, l.size());
assertEquals("http://www.ibiblio.org/maven/[module]/jars/[artifact]-[revision].jar", l
assertEquals("https://www.ibiblio.org/maven/[module]/jars/[artifact]-[revision].jar", l
.get(0));

resolver = (IBiblioResolver) _settings.getResolver("ibiblioE");
Expand All @@ -144,7 +144,7 @@ public void testInitFromConf() throws Exception {
assertNotNull(l);
assertEquals(1, l.size());
assertEquals(
"http://www.ibiblio.org/mymaven/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]",
"https://www.ibiblio.org/mymaven/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]",
l.get(0));

resolver = (IBiblioResolver) _settings.getResolver("ibiblioF");
Expand All @@ -154,7 +154,7 @@ public void testInitFromConf() throws Exception {
assertNotNull(l);
assertEquals(1, l.size());
assertEquals(
"http://www.ibiblio.org/mymaven/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]",
"https://www.ibiblio.org/mymaven/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]",
l.get(0));
}

Expand Down
Loading