olegk 2004/06/29 13:16:16 Modified: httpclient/xdocs authentication.xml Log: Added a section on alternate authentication Contributed by Michael Becke & Oleg Kalnichevski Revision Changes Path 1.12 +22 -9 jakarta-commons/httpclient/xdocs/authentication.xml Index: authentication.xml =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/xdocs/authentication.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- authentication.xml 12 Jun 2004 22:47:23 -0000 1.11 +++ authentication.xml 29 Jun 2004 20:16:15 -0000 1.12 @@ -49,11 +49,6 @@ <source>Credentials defaultcreds = new UsernamePasswordCredentials("username", "password"); client.getState().setCredentials(new AuthScope("myhost", 80, AuthScope.ANY_REALM), defaultcreds);</source> - <p>To enable preemptive authentication by default for all newly created - <tt>HttpState</tt>'s, a system property can be set, as shown below.</p> - - <source>setSystemProperty(Authenticator.PREEMPTIVE_PROPERTY, "true");</source> - <p>The preemptive authentication in HttpClient conforms to rfc2617:</p> <blockquote>A client SHOULD assume that all paths at or deeper than the depth @@ -95,9 +90,7 @@ authentication with the exception that the credentials for each are stored independantly. So for proxy authentication you must use <code>setProxyCredentials(AuthScope authscope, Credentials cred)</code> and - <code>getProxyCredentials(AuthScope authscope)</code>. As with server - authentication, passing <code>null</code> as the realm sets or returns - the default credentials.</p> + <code>getProxyCredentials(AuthScope authscope)</code>.</p> </section> <section name="Authentication Schemes"> @@ -176,6 +169,26 @@ <p>For a detailed explanation of how NTLM authentication works, please see <a href="http://davenport.sourceforge.net/ntlm.html"> http://davenport.sourceforge.net/ntlm.html</a>.</p> + </subsection> + <subsection name="Alternate authentication"> + <p>Some servers support multiple schemes for authenticating users. + Given that only one scheme may be used at a time for authenticating, HttpClient + must choose which scheme to use. To accompish this, HttpClient uses an order of + preference to select the correct authentication scheme. By default + this order is: NTLM, Digest, Basic. + </p> + <p>In certain cases it may be desirable to change this default. The + default preference of the authentication schemes may be altered using the + 'http.auth.scheme-priority' parameter. The parameter value is expected to be a List + of Strings containing names of authentication schemes in descending order of + preference. + </p> +<source>HttpClient client = new HttpClient(); +List authPrefs = new ArrayList(2); +authPrefs.add(AuthPolicy.DIGEST); +authPrefs.add(AuthPolicy.BASIC); +// This will exclude the NTLM authentication scheme +client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);</source> </subsection> </section>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]