Author: maartenc Date: Tue Oct 21 12:52:44 2008 New Revision: 706736 URL: http://svn.apache.org/viewvc?rev=706736&view=rev Log: NEW: Allow authentication credentials to be specified in settings file (IVY-943) (thanks to Randy Nott)
Added: ant/ivy/core/trunk/doc/settings/credentials.html Modified: ant/ivy/core/trunk/CHANGES.txt ant/ivy/core/trunk/doc/settings.html ant/ivy/core/trunk/doc/toc.json ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java Modified: ant/ivy/core/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=706736&r1=706735&r2=706736&view=diff ============================================================================== --- ant/ivy/core/trunk/CHANGES.txt (original) +++ ant/ivy/core/trunk/CHANGES.txt Tue Oct 21 12:52:44 2008 @@ -57,6 +57,7 @@ Glen Marchesani Phil Messenger Mathias Muller + Randy Nott Peter Oxenham Emmanuel Pellereau Roshan Punnoose @@ -84,6 +85,8 @@ ===================================== - DOCUMENTATION: Filesystem resolver: talks about "patterns" but does not mention these must become absolute file paths (IVY-910) +- NEW: Allow authentication credentials to be specified in settings file (IVY-943) (thanks to Randy Nott) + - IMPROVEMENT: Error messages on use of relative paths can be cyrptic (IVY-909) - IMPROVEMENT: Maven accepts illegal XML for its pom's, Ivy not (IVY-921) Modified: ant/ivy/core/trunk/doc/settings.html URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/settings.html?rev=706736&r1=706735&r2=706736&view=diff ============================================================================== --- ant/ivy/core/trunk/doc/settings.html (original) +++ ant/ivy/core/trunk/doc/settings.html Tue Oct 21 12:52:44 2008 @@ -72,6 +72,7 @@ <a href="settings/include.html">include</a> <a href="settings/classpath.html">classpath</a> <a href="settings/typedef.html">typedef</a> + <a href="settings/credentials.html">credentials</a> <a href="settings/lock-strategies.html">lock-strategies</a> <a href="settings/caches.html">caches</a> <a href="settings/caches/cache.html">cache</a> Added: ant/ivy/core/trunk/doc/settings/credentials.html URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/settings/credentials.html?rev=706736&view=auto ============================================================================== --- ant/ivy/core/trunk/doc/settings/credentials.html (added) +++ ant/ivy/core/trunk/doc/settings/credentials.html Tue Oct 21 12:52:44 2008 @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<html> +<head> + <script type="text/javascript">var xookiConfig = {level: 1};</script> + <script type="text/javascript" src="../xooki/xooki.js"></script> +</head> +<body> + <textarea id="xooki-source"> +<b>Tag:</b> credentials + +<span class="tagdoc" id="ivysettings.credentials">Configures HTTP authentication credentials.</span> <span class="since">since 2.0</span>. + +<h1>Attributes</h1> +<table class="ivy-attributes"> +<thead> + <tr><th class="ivy-att">Attribute</th><th class="ivy-att-desc">Description</th><th class="ivy-att-req">Required</th></tr> +</thead> +<tbody> + <tr><td>host</td><td>the name of the host</td> + <td>Yes</td></tr> + <tr><td>realm</td><td>the name of the realm</td> + <td>No</td></tr> + <tr><td>username</td><td>the username</td> + <td>Yes</td></tr> + <tr><td>passwd</td><td>the password</td> + <td>Yes</td></tr> +</tbody> +</table> +</textarea> +<script type="text/javascript">xooki.postProcess();</script> +</body> +</html> Modified: ant/ivy/core/trunk/doc/toc.json URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/toc.json?rev=706736&r1=706735&r2=706736&view=diff ============================================================================== --- ant/ivy/core/trunk/doc/toc.json (original) +++ ant/ivy/core/trunk/doc/toc.json Tue Oct 21 12:52:44 2008 @@ -186,6 +186,13 @@ ] }, { + "id":"settings/credentials", + "title":"credentials", + "children": [ + + ] + }, + { "id":"settings/lock-strategies", "title":"lock-strategies", "children": [ Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java?rev=706736&r1=706735&r2=706736&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java Tue Oct 21 12:52:44 2008 @@ -46,6 +46,7 @@ import org.apache.ivy.util.Configurator; import org.apache.ivy.util.FileResolver; import org.apache.ivy.util.Message; +import org.apache.ivy.util.url.CredentialsStore; import org.apache.ivy.util.url.URLHandler; import org.apache.ivy.util.url.URLHandlerRegistry; import org.xml.sax.Attributes; @@ -221,6 +222,8 @@ macrodefStarted(qName, attributes); } else if ("module".equals(qName)) { moduleStarted(attributes); + } else if ("credentials".equals(qName)) { + credentialsStarted(attributes); } } catch (ParseException ex) { SAXException sax = new SAXException("problem in config file: " + ex.getMessage(), ex); @@ -234,6 +237,14 @@ } } + private void credentialsStarted(Map attributes) { + String realm = (String) attributes.remove("realm"); + String host = (String) attributes.remove("host"); + String userName = (String) attributes.remove("username"); + String passwd = (String) attributes.remove("passwd"); + CredentialsStore.INSTANCE.addCredentials(realm, host, userName, passwd); + } + private void moduleStarted(Map attributes) { attributes.put(IvyPatternHelper.MODULE_KEY, attributes.remove("name")); String resolver = (String) attributes.remove("resolver");