/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4432213
* @summary Need to support Digest Authentication for Proxies
*/
/* This is one simple test of the RFC2617 digest authentication behavior
* It specifically tests that the client correctly checks the returned
* Authentication-Info header field from the server and throws an exception
* if the password is wrong
*/
ServerSocket s;
int port;
"Date: Mon, 15 Jan 2001 12:18:21 GMT\r\n" +
"Server: Apache/1.3.14 (Unix)\r\n" +
"Transfer-encoding: chunked\r\n\r\n"+
"B\r\nHelloWorld1\r\n"+
"B\r\nHelloWorld2\r\n"+
"B\r\nHelloWorld3\r\n"+
"B\r\nHelloWorld4\r\n"+
"B\r\nHelloWorld5\r\n"+
"0\r\n"+
"Authentication-Info: ";
s = y;
port = s.getLocalPort();
}
public void run () {
try {
// need to get the cnonce out of the response
} catch (Exception e) {
e.printStackTrace();
} finally {
}
}
try {
} catch (NoSuchAlgorithmException ex) {
return null;
}
+ " qop=auth\""
+ "\", cnonce=\"" + cnonce
+ "\", rspauth=\"" + response
return (value+ "\r\n");
}
) throws NoSuchAlgorithmException
{
{
}
if (isRequest) {
} else {
}
{ /* RRC2617 when qop=auth */
}
return finalHash;
}
private final static char charArray[] = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
};
passwdBytes[i] = (byte)passwd[i];
}
}
}
}
public class DigestTest {
public MyAuthenticator () {
super ();
}
{
}
}
int port;
try {
}
catch (Exception e) {
return;
}
boolean passed = false;
try {
} catch(ProtocolException e) {
passed = true;
}
if (!passed) {
throw new RuntimeException ("Expected a ProtocolException from wrong password");
}
}
}