[jcifs] Domain Controllers

MSDean at beckman.com MSDean at beckman.com
Wed Feb 2 19:18:29 GMT 2005


I am using JCIFS to perform NTLM authentication in a Weblogic environment. I
have created a custom authenticator, and the login method is included below.

My question is, is it possible to avoid providing hard-coded domain controllers
(dc) to the logon method?

I have to deal with many domains, each of which may have several associated
domain controllers. I am trying to find a way to avoid the need to explicitly
provide domain controllers to the login method, since the controllers may not
always be available or are subject to change.

Any suggestions would be appreciated.

Thanks,
Mark


      private boolean login( String userName, String domainName, String
controller, String password ) throws FailedLoginException {
            boolean succeeded = false;
            try {
                  UniAddress dc = UniAddress.getByName(controller);
                  NtlmPasswordAuthentication auth = new
NtlmPasswordAuthentication(domainName + ";" + userName + ":" + password);
                  SmbSession.logon(dc, auth);
                  succeeded = true;
            } catch (SmbException e) {
                  logger.error("Authentication failed.", e);
                  return false;
            } catch (UnknownHostException e) {
                  logger.error("Authentication failed (unknown host).", e);
            }
            logger.info("Authentication succeeded.");
            return succeeded;
      }





More information about the jcifs mailing list