if (!authenticated) {// authentication part one
for (int i = 0; i < requestKeyValuePairs.size(); ++i) {
final String[] split = TextParameter.splitKeyValuePair(requestKeyValuePairs.get(i));
if (split == null) {
sendRejectPdu(LoginStatus.INITIATOR_ERROR);
throw new InternetSCSIException("key=value format error: " + requestKeyValuePairs.get(i));
}
if (TextKeyword.AUTH_METHOD.equals(split[0])) {
authMethodValues = split[1];
// remove key-value pair from Vector
requestKeyValuePairs.remove(i--);// correct for shifted
// indices
// no break here to catch all authMethodKeyValuePairs in
// else block
} else if (isAuthenticationKey(split[0])) {
// move key-value pair to authMethodKeyValuePairs
authMethodKeyValuePairs.add(requestKeyValuePairs.remove(i--));// correct for shifted
// indices
}
}
if (authMethodValues == null) {// missing AuthMethod key
sendRejectPdu(LoginStatus.MISSING_PARAMETER);// require
// AuthMethod
// to be
// specified in
// first PDU
// sequence
// close connection
throw new InternetSCSIException("Missing AuthMethod key-value pair");
}
}
// negotiate remaining parameters
final Vector<String> responseKeyValuePairs = new Vector<String>();// these
// will
// be
// sent
// back
if (!negotiator.negotiate(session.getTargetServer(), stageNumber, connection.isLeadingConnection(), ((TargetLoginPhase) targetPhase).getFirstPduAndSetToFalse(), requestKeyValuePairs, responseKeyValuePairs)) {
// negotiation error
sendRejectPdu(LoginStatus.INITIATOR_ERROR);
throw new InternetSCSIException("negotiation failure");
}
// ** authentication ** (part two)
if (!authenticated) {
if (authMethodValues.contains(TextKeyword.NONE)) {