APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.security.sasl.ntlm

pack-priv final Class NTLMClient

extends Object
implements SaslClient
Class Inheritance
All Implemented Interfaces
javax.security.sasl.SaslClient
Imports
com.sun.security.ntlm.Client, .NTLMException, java.io.IOException, java.net.InetAddress, .UnknownHostException, java.util.Map, .Random, javax.security.auth.callback.Callback, .CallbackHandler, .NameCallback, .PasswordCallback, .UnsupportedCallbackException, javax.security.sasl.*

Required callbacks: - RealmCallback handle can provide domain info for authentication, optional - NameCallback handler must enter username to use for authentication - PasswordCallback handler must enter password for username to use for authentication Environment properties that affect behavior of implementation: javax.security.sasl.qop String, quality of protection; only "auth" is accepted, default "auth" com.sun.security.sasl.ntlm.version String, name a specific version to use; can be: LM/NTLM: Original NTLM v1 LM: Original NTLM v1, LM only NTLM: Original NTLM v1, NTLM only NTLM2: NTLM v1 with Client Challenge LMv2/NTLMv2: NTLM v2 LMv2: NTLM v2, LM only NTLMv2: NTLM v2, NTLM only If not specified, use system property "ntlm.version". If still not specified, use default value "LMv2/NTLMv2". com.sun.security.sasl.ntlm.random java.util.Random, the nonce source to be used in NTLM v2 or NTLM v1 with Client Challenge. Default null, an internal java.util.Random object will be used Negotiated Properties: javax.security.sasl.qop Always "auth" com.sun.security.sasl.html.domain The domain for the user, provided by the server
See Also
RFC 2222 - Simple Authentication and Security Layer (SASL)

Field Summary

Modifier and TypeField and Description
private final Client
private final String
private static final String
private static final String
private static final String
private static final String
private final Random
private int

Constructor Summary

AccessConstructor and Description
pack-priv
NTLMClient(String
non-null
mech
,
String authzid, String
non-null for Sasl, useless for NTLM
protocol
,
String
non-null for Sasl, but can be null for NTLM
serverName
,
Map<String, ?>
can be null
props
,
CallbackHandler
can be null for Sasl, already null-checked in factory
cbh
)

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements javax.security.sasl.SaslClient.dispose.

Disposes of any system resources or security-sensitive information the SaslClient might be using.

public byte[]
evaluateChallenge(byte[] challenge)

Implements javax.security.sasl.SaslClient.evaluateChallenge.

Evaluates the challenge data and generates a response.

public String
getMechanismName()

Implements javax.security.sasl.SaslClient.getMechanismName.

Returns the IANA-registered mechanism name of this SASL client.

public Object
getNegotiatedProperty(String propName)

Implements javax.security.sasl.SaslClient.getNegotiatedProperty.

Retrieves the negotiated property.

public boolean
hasInitialResponse()

Implements javax.security.sasl.SaslClient.hasInitialResponse.

Determines whether this mechanism has an optional initial response.

public boolean
isComplete()

Implements javax.security.sasl.SaslClient.isComplete.

Determines whether the authentication exchange has completed.

public byte[]
unwrap(byte[] incoming, int offset, int len)

Implements javax.security.sasl.SaslClient.unwrap.

Unwraps a byte array received from the server.

public byte[]
wrap(byte[] outgoing, int offset, int len)

Implements javax.security.sasl.SaslClient.wrap.

Wraps a byte array to be sent to the server.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clientback to summary
private final Client client
mechback to summary
private final String mech
NTLM_DOMAINback to summary
private static final String NTLM_DOMAIN
NTLM_HOSTNAMEback to summary
private static final String NTLM_HOSTNAME
NTLM_RANDOMback to summary
private static final String NTLM_RANDOM
NTLM_VERSIONback to summary
private static final String NTLM_VERSION
randomback to summary
private final Random random
stepback to summary
private int step

Constructor Detail

NTLMClientback to summary
pack-priv NTLMClient(String mech, String authzid, String protocol, String serverName, Map<String, ?> props, CallbackHandler cbh) throws SaslException
Parameters
mech:String

non-null

protocol:String

non-null for Sasl, useless for NTLM

serverName:String

non-null for Sasl, but can be null for NTLM

props:Map<String, ?>

can be null

cbh:CallbackHandler

can be null for Sasl, already null-checked in factory

Method Detail

disposeback to summary
public void dispose() throws SaslException

Implements javax.security.sasl.SaslClient.dispose.

Doc from javax.security.sasl.SaslClient.dispose.

Disposes of any system resources or security-sensitive information the SaslClient might be using. Invoking this method invalidates the SaslClient instance. This method is idempotent.

Annotations
@Override
Exceptions
SaslException:
If a problem was encountered while disposing the resources.
evaluateChallengeback to summary
public byte[] evaluateChallenge(byte[] challenge) throws SaslException

Implements javax.security.sasl.SaslClient.evaluateChallenge.

Doc from javax.security.sasl.SaslClient.evaluateChallenge.

Evaluates the challenge data and generates a response. If a challenge is received from the server during the authentication process, this method is called to prepare an appropriate next response to submit to the server.

Annotations
@Override
Exceptions
SaslException:
If an error occurred while processing the challenge or generating a response.
getMechanismNameback to summary
public String getMechanismName()

Implements javax.security.sasl.SaslClient.getMechanismName.

Doc from javax.security.sasl.SaslClient.getMechanismName.

Returns the IANA-registered mechanism name of this SASL client. (e.g. "CRAM-MD5", "GSSAPI").

Annotations
@Override
getNegotiatedPropertyback to summary
public Object getNegotiatedProperty(String propName)

Implements javax.security.sasl.SaslClient.getNegotiatedProperty.

Doc from javax.security.sasl.SaslClient.getNegotiatedProperty.

Retrieves the negotiated property. This method can be called only after the authentication exchange has completed (i.e., when isComplete() returns true); otherwise, an IllegalStateException is thrown.

The Sasl class includes several well-known property names (For example, Sasl#QOP). A SASL provider can support other properties which are specific to the vendor and/or a mechanism.

Annotations
@Override
hasInitialResponseback to summary
public boolean hasInitialResponse()

Implements javax.security.sasl.SaslClient.hasInitialResponse.

Doc from javax.security.sasl.SaslClient.hasInitialResponse.

Determines whether this mechanism has an optional initial response. If true, caller should call evaluateChallenge() with an empty array to get the initial response.

Annotations
@Override
isCompleteback to summary
public boolean isComplete()

Implements javax.security.sasl.SaslClient.isComplete.

Doc from javax.security.sasl.SaslClient.isComplete.

Determines whether the authentication exchange has completed. This method may be called at any time, but typically, it will not be called until the caller has received indication from the server (in a protocol-specific manner) that the exchange has completed.

Annotations
@Override
unwrapback to summary
public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException

Implements javax.security.sasl.SaslClient.unwrap.

Doc from javax.security.sasl.SaslClient.unwrap.

Unwraps a byte array received from the server. This method can be called only after the authentication exchange has completed (i.e., when isComplete() returns true) and only if the authentication exchange has negotiated integrity and/or privacy as the quality of protection; otherwise, an IllegalStateException is thrown.

incoming is the contents of the SASL buffer as defined in RFC 2222 without the leading four octet field that represents the length. offset and len specify the portion of incoming to use.

Annotations
@Override
Exceptions
SaslException:
if incoming cannot be successfully unwrapped.
wrapback to summary
public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException

Implements javax.security.sasl.SaslClient.wrap.

Doc from javax.security.sasl.SaslClient.wrap.

Wraps a byte array to be sent to the server. This method can be called only after the authentication exchange has completed (i.e., when isComplete() returns true) and only if the authentication exchange has negotiated integrity and/or privacy as the quality of protection; otherwise, an IllegalStateException is thrown.

The result of this method will make up the contents of the SASL buffer as defined in RFC 2222 without the leading four octet field that represents the length. offset and len specify the portion of outgoing to use.

Annotations
@Override
Exceptions
SaslException:
if outgoing cannot be successfully wrapped.