/*
* 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
/**
* DefaultCallbackHandler for satisfying NameCallback and
* PasswordCallback for an LDAP client.
* NameCallback is used for getting the authentication ID and is
* gotten from the java.naming.security.principal property.
* PasswordCallback is gotten from the java.naming.security.credentials
* property and must be of type String, char[] or byte[].
* If byte[], it is assumed to have UTF-8 encoding.
*
* If the caller of getPassword() will be using the password as
* a byte array, then it should encode the char[] array returned by
* getPassword() into a byte[] using UTF-8.
*
* @author Rosanna Lee
*/
private char[] passwd;
throws IOException {
} else if (cred instanceof char[]) {
// assume UTF-8 encoding
}
}
throws IOException, UnsupportedCallbackException {
if (callbacks[i] instanceof NameCallback) {
} else if (callbacks[i] instanceof PasswordCallback) {
} else if (callbacks[i] instanceof RealmChoiceCallback) {
/* Deals with a choice of realms */
int selected = 0;
selected = j;
}
}
if (selected == -1) {
}
throw new IOException("Cannot match " +
"'java.naming.security.sasl.realm' property value, '" +
"in RealmChoiceCallback");
}
}
} else if (callbacks[i] instanceof RealmCallback) {
/* 1 or 0 realms specified in challenge */
} else {
if (defaultRealm != null) {
} else {
}
}
} else {
throw new UnsupportedCallbackException(callbacks[i]);
}
}
}
void clearPassword() {
passwd[i] = '\0';
}
}
}
}
}