FileDocCategorySizeDatePackage
NtlmSsp.javaAPI DocJCIFS 1.3.17 API4612Tue Oct 18 15:26:24 BST 2011jcifs.http

NtlmSsp

public class NtlmSsp extends Object implements jcifs.ntlmssp.NtlmFlags
This class is used internally by NtlmHttpFilter, NtlmServlet, and NetworkExplorer to negiotiate password hashes via NTLM SSP with MSIE. It might also be used directly by servlet containers to incorporate similar functionality.

How NTLMSSP is used in conjunction with HTTP and MSIE clients is described in an NTLM Authentication Scheme for HTTP.

Also, read jCIFS NTLM HTTP Authentication and the Network Explorer Servlet related information.

Fields Summary
Constructors Summary
Methods Summary
public static jcifs.smb.NtlmPasswordAuthenticationauthenticate(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, byte[] challenge)
Performs NTLM authentication for the servlet request.

param
req The request being serviced.
param
resp The response.
param
challenge The domain controller challenge.
throws
IOException If an IO error occurs.
throws
ServletException If an error occurs.

        String msg = req.getHeader("Authorization");
        if (msg != null && msg.startsWith("NTLM ")) {
            byte[] src = Base64.decode(msg.substring(5));
            if (src[8] == 1) {
                Type1Message type1 = new Type1Message(src);
                Type2Message type2 = new Type2Message(type1, challenge, null);
                msg = Base64.encode(type2.toByteArray());
                resp.setHeader( "WWW-Authenticate", "NTLM " + msg );
            } else if (src[8] == 3) {
                Type3Message type3 = new Type3Message(src);
                byte[] lmResponse = type3.getLMResponse();
                if (lmResponse == null) lmResponse = new byte[0];
                byte[] ntResponse = type3.getNTResponse();
                if (ntResponse == null) ntResponse = new byte[0];
                return new NtlmPasswordAuthentication(type3.getDomain(),
                        type3.getUser(), challenge, lmResponse, ntResponse);
            }
        } else {
            resp.setHeader("WWW-Authenticate", "NTLM");
        }
        resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
        resp.setContentLength(0);
        resp.flushBuffer();
        return null;
    
public jcifs.smb.NtlmPasswordAuthenticationdoAuthentication(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, byte[] challenge)
Calls the static {@link #authenticate(HttpServletRequest, HttpServletResponse, byte[])} method to perform NTLM authentication for the specified servlet request.

param
req The request being serviced.
param
resp The response.
param
challenge The domain controller challenge.
throws
IOException If an IO error occurs.
throws
ServletException If an error occurs.

        return authenticate(req, resp, challenge);