/*
* 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 6911951
* @summary NTLM should be a supported Java SASL mechanism
*/
public class NTLMTest {
static {
}
}
}
// Server accepts all version
// Client's default version is LMv2
// Also works if they specified identical versions
// But should not work if different
try {
throw new Exception("Should not succeed");
} catch (SaslException se) {
// OK
}
try {
throw new Exception("Should not succeed");
} catch (SaslException se) {
// OK
}
}
/**
* A test on version matching
* @param vc ntlm version specified for client
* @param vs ntlm version specified for server
* @throws Exception
*/
new CallbackHandler() {
throws IOException, UnsupportedCallbackException {
if (cb instanceof NameCallback) {
} else if (cb instanceof PasswordCallback) {
}
}
}
});
new CallbackHandler() {
throws IOException, UnsupportedCallbackException {
if (cb instanceof NameCallback) {
} else if (cb instanceof RealmCallback) {
} else if (cb instanceof PasswordCallback) {
}
}
}
}
});
}
new CallbackHandler() {
throws IOException, UnsupportedCallbackException {
if (cb instanceof NameCallback) {
} else if (cb instanceof PasswordCallback) {
}
}
}
});
new CallbackHandler() {
throws IOException, UnsupportedCallbackException {
if (cb instanceof NameCallback) {
} else if (cb instanceof RealmCallback) {
} else if (cb instanceof PasswordCallback) {
}
}
}
}
});
if (!"this.is.com".equals(
throw new Exception("Hostname not trasmitted to server");
}
}
/**
* Client realm override, but finally overridden by server response
*/
new CallbackHandler() {
throws IOException, UnsupportedCallbackException {
if (cb instanceof NameCallback) {
} else if(cb instanceof RealmCallback) {
} else if (cb instanceof PasswordCallback) {
}
}
}
});
new CallbackHandler() {
throws IOException, UnsupportedCallbackException {
if (cb instanceof NameCallback) {
} else if (cb instanceof RealmCallback) {
} else if (cb instanceof PasswordCallback) {
}
}
}
}
});
}
/**
* Client side user name provided in callback.
* @throws Exception
*/
new CallbackHandler() {
throws IOException, UnsupportedCallbackException {
if (cb instanceof NameCallback) {
} else if (cb instanceof PasswordCallback) {
}
}
}
});
new CallbackHandler() {
throws IOException, UnsupportedCallbackException {
if (cb instanceof NameCallback) {
} else if (cb instanceof RealmCallback) {
} else if (cb instanceof PasswordCallback) {
}
}
}
}
});
}
/**
* server side domain provided in props.
* @throws Exception
*/
new CallbackHandler() {
throws IOException, UnsupportedCallbackException {
if (cb instanceof NameCallback) {
} else if (cb instanceof PasswordCallback) {
}
}
}
});
new CallbackHandler() {
throws IOException, UnsupportedCallbackException {
if (cb instanceof NameCallback) {
} else if (cb instanceof RealmCallback) {
} else if (cb instanceof PasswordCallback) {
}
}
}
}
});
}
try {
throw new Exception("NTLM should not support auth-conf");
} catch (SaslException se) {
// Normal
}
}
throws Exception {
throw new IllegalStateException(
"Unable to find client impl for " + MECH);
}
throw new IllegalStateException(
"Unable to find server impl for " + MECH);
}
byte[] challenge;
}
}
}
throw new Exception("Not correct user");
}
} else {
throw new IllegalStateException(
"FAILURE: mismatched state:"
}
throw new Exception("Negotiated property error");
}
}
}