Details
-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b04
-
generic
-
generic
-
Verified
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2210487 | 7u2 | Weijun Wang | P2 | Resolved | Fixed | b06 |
Description
Platform: Windows, Solaris
JDK: Oracle JDK7
(not reproducible on Sun's JDK6 as NTLMServer is not present there)
The com.sun.security.sasl.ntlm.NTLMServer implementaiton of method
http://download.java.net/jdk7/docs/api/javax/security/sasl/SaslServer.html#getNegotiatedProperty%28java.lang.String%29
Does not throw specified:
Throws:
IllegalStateException - if this authentication session has not completed
Please see the following code sample:
--------------------------------------------------------------------------------------------
package sasl;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslException;
import javax.security.sasl.SaslServer;
import javax.security.sasl.SaslServerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
public class GetAuthorizationID {
public static void main(String[] args) throws SaslException {
ArrayList<SaslServerFactory> list = Collections.list(Sasl.getSaslServerFactories());
for (SaslServerFactory saslServerFactory : list) {
System.err.println("saslServerFactory = " + saslServerFactory);
String[] mechanismNames = saslServerFactory.getMechanismNames(null);
if (mechanismNames.length == 1 && "NTLM".equals(mechanismNames[0])) {
SaslServer saslServer =
saslServerFactory.createSaslServer("NTLM", "ldap", "abc", null, new CallbackHandler() {
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { }
});
System.err.println("saslServer = " + saslServer);
System.err.println("saslServer.isComplete() = " + saslServer.isComplete());
// IllegalStateException is expected here
saslServer.getNegotiatedProperty("prop");
System.err.println("No IllegalStateException");
}
}
}
}
--------------------------------------------------------------------------------------------
The output will look like:
saslServerFactory = com.sun.security.sasl.gsskerb.FactoryImpl@11a0d8b
saslServerFactory = com.sun.security.sasl.digest.FactoryImpl@557c15
saslServerFactory = com.sun.security.sasl.ServerFactoryImpl@ee7cee
saslServerFactory = com.sun.security.sasl.ntlm.FactoryImpl@161e946
saslServer = com.sun.security.sasl.ntlm.NTLMServer@113c652
saslServer.isComplete() = false
No IllegalStateException
JDK: Oracle JDK7
(not reproducible on Sun's JDK6 as NTLMServer is not present there)
The com.sun.security.sasl.ntlm.NTLMServer implementaiton of method
http://download.java.net/jdk7/docs/api/javax/security/sasl/SaslServer.html#getNegotiatedProperty%28java.lang.String%29
Does not throw specified:
Throws:
IllegalStateException - if this authentication session has not completed
Please see the following code sample:
--------------------------------------------------------------------------------------------
package sasl;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslException;
import javax.security.sasl.SaslServer;
import javax.security.sasl.SaslServerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
public class GetAuthorizationID {
public static void main(String[] args) throws SaslException {
ArrayList<SaslServerFactory> list = Collections.list(Sasl.getSaslServerFactories());
for (SaslServerFactory saslServerFactory : list) {
System.err.println("saslServerFactory = " + saslServerFactory);
String[] mechanismNames = saslServerFactory.getMechanismNames(null);
if (mechanismNames.length == 1 && "NTLM".equals(mechanismNames[0])) {
SaslServer saslServer =
saslServerFactory.createSaslServer("NTLM", "ldap", "abc", null, new CallbackHandler() {
@Override
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { }
});
System.err.println("saslServer = " + saslServer);
System.err.println("saslServer.isComplete() = " + saslServer.isComplete());
// IllegalStateException is expected here
saslServer.getNegotiatedProperty("prop");
System.err.println("No IllegalStateException");
}
}
}
}
--------------------------------------------------------------------------------------------
The output will look like:
saslServerFactory = com.sun.security.sasl.gsskerb.FactoryImpl@11a0d8b
saslServerFactory = com.sun.security.sasl.digest.FactoryImpl@557c15
saslServerFactory = com.sun.security.sasl.ServerFactoryImpl@ee7cee
saslServerFactory = com.sun.security.sasl.ntlm.FactoryImpl@161e946
saslServer = com.sun.security.sasl.ntlm.NTLMServer@113c652
saslServer.isComplete() = false
No IllegalStateException
Attachments
Issue Links
- backported by
-
JDK-2210487 NTML impl of SaslServer doesn't throw ISE from getNegotiatedProperty() method
-
- Resolved
-