Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 11 java.naming.jmod - Naming Module
JDK 11 java.naming.jmod is the JMOD file for JDK 11 Naming module.
JDK 11 Naming module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\java.naming.jmod.
JDK 11 Naming module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 Naming module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\java.naming.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java
/*
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.jndi.ldap.sasl;
import javax.security.auth.callback.*;
import javax.security.sasl.RealmCallback;
import javax.security.sasl.RealmChoiceCallback;
import java.io.IOException;
/**
* 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
*/
final class DefaultCallbackHandler implements CallbackHandler {
private char[] passwd;
private String authenticationID;
private String authRealm;
DefaultCallbackHandler(String principal, Object cred, String realm)
throws IOException {
authenticationID = principal;
authRealm = realm;
if (cred instanceof String) {
passwd = ((String)cred).toCharArray();
} else if (cred instanceof char[]) {
passwd = ((char[])cred).clone();
} else if (cred != null) {
// assume UTF-8 encoding
String orig = new String((byte[])cred, "UTF8");
passwd = orig.toCharArray();
}
}
public void handle(Callback[] callbacks)
throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof NameCallback) {
((NameCallback)callbacks[i]).setName(authenticationID);
} else if (callbacks[i] instanceof PasswordCallback) {
((PasswordCallback)callbacks[i]).setPassword(passwd);
} else if (callbacks[i] instanceof RealmChoiceCallback) {
/* Deals with a choice of realms */
String[] choices =
((RealmChoiceCallback)callbacks[i]).getChoices();
int selected = 0;
if (authRealm != null && authRealm.length() > 0) {
selected = -1; // no realm chosen
for (int j = 0; j < choices.length; j++) {
if (choices[j].equals(authRealm)) {
selected = j;
}
}
if (selected == -1) {
StringBuilder allChoices = new StringBuilder();
for (int j = 0; j < choices.length; j++) {
allChoices.append(choices[j]).append(',');
}
throw new IOException("Cannot match " +
"'java.naming.security.sasl.realm' property value, '" +
authRealm + "' with choices " + allChoices +
"in RealmChoiceCallback");
}
}
((RealmChoiceCallback)callbacks[i]).setSelectedIndex(selected);
} else if (callbacks[i] instanceof RealmCallback) {
/* 1 or 0 realms specified in challenge */
RealmCallback rcb = (RealmCallback) callbacks[i];
if (authRealm != null) {
rcb.setText(authRealm); // Use what user supplied
} else {
String defaultRealm = rcb.getDefaultText();
if (defaultRealm != null) {
rcb.setText(defaultRealm); // Use what server supplied
} else {
rcb.setText(""); // Specify no realm
}
}
} else {
throw new UnsupportedCallbackException(callbacks[i]);
}
}
}
void clearPassword() {
if (passwd != null) {
for (int i = 0; i < passwd.length; i++) {
passwd[i] = '\0';
}
passwd = null;
}
}
@SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
clearPassword();
}
}
⏎ com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java
Or download all of them as a single archive file:
File name: java.naming-11.0.1-src.zip File size: 461792 bytes Release date: 2018-11-04 Download
⇒ JDK 11 java.net.http.jmod - Net HTTP Module
2020-09-30, ≈84🔥, 0💬
Popular Posts:
Xalan-Java, Version 2.7.1, is an XSLT processor for transforming XML documents into HTML, text, or o...
MP3SPI is a Java Service Provider Interface that adds MP3 (MPEG 1/2/2.5 Layer 1/2/3) audio format su...
Jettison is a collection of Java APIs (like STaX and DOM) which read and write JSON. This allows nea...
Where to find answers to frequently asked questions on Downloading and Using JDK (Java Development K...
XOM™ is a new XML object model. It is an open source (LGPL), tree-based API for processing XML with ...