/*
* 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 6870935
*/
/* 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
*/
public class B6870935 {
static volatile boolean error = false;
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"+
"Proxy-Authentication-Info: ";
s = y;
port = s.getLocalPort();
}
public void run () {
try {
// need to get the cnonce out of the response
);
s.close ();
error = true;
return;
}
) +"\r\n";
}
catch (Exception e) {
e.printStackTrace();
}
}
private String getAuthorization (String realm, boolean isRequest, String uri, String method, String cnonce, String cnstring, char[] password, String username) {
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 MyAuthenticator () {
super ();
}
{
}
}
int nLoops = 1;
int nSize = 10;
int port, n =0;
byte b[] = new byte[nSize];
try {
}
catch (Exception e) {
return;
}
try {
String s = "http://www.ibm.com";
int c;
}
}
catch(IOException e) {
e.printStackTrace();
error = true;
}
if (error) {
throw new RuntimeException ("Error in test");
}
}
}