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

pack-priv final Class NTLMServer

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

Required callbacks: - RealmCallback used as key by handler to fetch password, optional - NameCallback used as key by handler to fetch password - PasswordCallback handler must enter password for username/realm supplied Environment properties that affect the 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 accept: 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 also not specified, all versions are accepted. com.sun.security.sasl.ntlm.domain String, the domain of the server, default is server name (fqdn parameter) com.sun.security.sasl.ntlm.random java.util.Random, the nonce source. Default null, an internal java.util.Random object will be used Negotiated Properties: javax.security.sasl.qop Always "auth" com.sun.security.sasl.ntlm.hostname The hostname for the user, provided by the client

Field Summary

Modifier and TypeField and Description
private String
private String
private final String
private byte[]
private static final String
private static final String
private static final String
private static final String
private final Random
private final Server
private int
private String

Constructor Summary

AccessConstructor and Description
pack-priv
NTLMServer(String
not null
mech
,
String
not null for Sasl, ignored in NTLM
protocol
,
String
not null for Sasl, can be null in NTLM. If non-null, might be used as domain if not provided in props
serverName
,
Map<String, ?>
can be null
props
,
final 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.SaslServer.dispose.

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

public byte[]
evaluateResponse(byte[] response)

Implements javax.security.sasl.SaslServer.evaluateResponse.

Evaluates the response data and generates a challenge.

public String
getAuthorizationID()

Implements javax.security.sasl.SaslServer.getAuthorizationID.

Reports the authorization ID in effect for the client of this session.

public String
getMechanismName()

Implements javax.security.sasl.SaslServer.getMechanismName.

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

public Object
getNegotiatedProperty(String propName)

Implements javax.security.sasl.SaslServer.getNegotiatedProperty.

Retrieves the negotiated property.

public boolean
isComplete()

Implements javax.security.sasl.SaslServer.isComplete.

Determines whether the authentication exchange has completed.

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

Implements javax.security.sasl.SaslServer.unwrap.

Unwraps a byte array received from the client.

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

Implements javax.security.sasl.SaslServer.wrap.

Wraps a byte array to be sent to the client.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

authzIdback to summary
private String authzId
hostnameback to summary
private String hostname
mechback to summary
private final String mech
nonceback to summary
private byte[] nonce
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
serverback to summary
private final Server server
stepback to summary
private int step
targetback to summary
private String target

Constructor Detail

NTLMServerback to summary
pack-priv NTLMServer(String mech, String protocol, String serverName, Map<String, ?> props, final CallbackHandler cbh) throws SaslException
Parameters
mech:String

not null

protocol:String

not null for Sasl, ignored in NTLM

serverName:String

not null for Sasl, can be null in NTLM. If non-null, might be used as domain if not provided in props

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.SaslServer.dispose.

Doc from javax.security.sasl.SaslServer.dispose.

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

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

Implements javax.security.sasl.SaslServer.evaluateResponse.

Doc from javax.security.sasl.SaslServer.evaluateResponse.

Evaluates the response data and generates a challenge. If a response is received from the client during the authentication process, this method is called to prepare an appropriate next challenge to submit to the client. The challenge is null if the authentication has succeeded and no more challenge data is to be sent to the client. It is non-null if the authentication must be continued by sending a challenge to the client, or if the authentication has succeeded but challenge data needs to be processed by the client. isComplete() should be called after each call to evaluateResponse(), to determine if any further response is needed from the client.

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

Implements javax.security.sasl.SaslServer.getAuthorizationID.

Doc from javax.security.sasl.SaslServer.getAuthorizationID.

Reports the authorization ID in effect for the client of this session. This method can only be called if isComplete() returns true.

Annotations
@Override
getMechanismNameback to summary
public String getMechanismName()

Implements javax.security.sasl.SaslServer.getMechanismName.

Doc from javax.security.sasl.SaslServer.getMechanismName.

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

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

Implements javax.security.sasl.SaslServer.getNegotiatedProperty.

Doc from javax.security.sasl.SaslServer.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
isCompleteback to summary
public boolean isComplete()

Implements javax.security.sasl.SaslServer.isComplete.

Doc from javax.security.sasl.SaslServer.isComplete.

Determines whether the authentication exchange has completed. This method is typically called after each invocation of evaluateResponse() to determine whether the authentication has completed successfully or should be continued.

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

Implements javax.security.sasl.SaslServer.unwrap.

Doc from javax.security.sasl.SaslServer.unwrap.

Unwraps a byte array received from the client. 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.SaslServer.wrap.

Doc from javax.security.sasl.SaslServer.wrap.

Wraps a byte array to be sent to the client. 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, a SaslException 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.