[jcifs] JCIFS Authentication on UNIX Box

Baba_Bong123 java.kumarmitra at gmail.com
Wed May 19 06:39:32 MDT 2010


We have an application which was developed in the Windows XP environment. Now
we have to migrate it to Unix [Solaris] for production. The JCIFS
authentictaion on LDAP runs fine in the windows environment. But when we are
using UNIX it is failing and throwing UnknownHostException.  Here is the
method we are using:

 private boolean authenticateUserOnActiveDirectory(String userName, String
password){
    	boolean status = false;
    	String ldapEnabled = ApplicationProperties.getProperty("ldap.enabled");
    	if(ldapEnabled.equalsIgnoreCase(LDAP_DISABLED)){
    		log.info("LDAP Diabled?: " + ldapEnabled);
    		return true;
    	}
    	
    	/*
    	 * Setting the properties of Config.
    	 */
    	String defaultDomain =
ApplicationProperties.getProperty("mpweb.default.domain");
    	UniAddress dc = null;
    	NtlmPasswordAuthentication ntlm = null;
    	Config.setProperty("jcifs.smb.client.soTimeout",
ApplicationProperties.getProperty("jcifs.smb.client.soTimeout"));
    	Config.setProperty("jcifs.netbios.cachePolicy",
ApplicationProperties.getProperty("jcifs.netbios.cachePolicy"));
    	Config.setProperty("jcifs.netbios.wins",
ApplicationProperties.getProperty("jcifs.netbios.wins"));
    	Config.setProperty("jcifs.smb.client.domain",
ApplicationProperties.getProperty("jcifs.smb.client.domain"));
    	Config.setProperty("jcifs.smb.client.username",
ApplicationProperties.getProperty("jcifs.smb.client.username"));
    	Config.setProperty("jcifs.smb.client.password",
ApplicationProperties.getProperty("jcifs.smb.client.password"));
    	ntlm = new NtlmPasswordAuthentication(defaultDomain, userName,
password);
    	try {
			dc = UniAddress.getByName(defaultDomain, true);
		} catch (UnknownHostException e) {
			log.info("Unknown domain {0}: ",defaultDomain);
			return status;
		}
    	try {
			SmbSession.logon(dc, ntlm);
			status = true;
			log.info("LDAP Authentication Passed on OURDOMAIN for user {0}, using
NTLM with JCIFS.", userName);
		} catch (SmbException e) {
			log.info("Invalid username or password");
			return status;
		}
    	return status;
    }

we have a properties file which has all configuration properties;
########################LDAP PROPERTIES #########################
ldap.enabled=ENABLED
jcifs.smb.client.soTimeout=1800000
jcifs.netbios.cachePolicy=1200
jcifs.netbios.wins=10.21.18.167,10.21.118.31
jcifs.smb.client.domain=OURDOMAIN
jcifs.smb.client.username=USER
jcifs.smb.client.password=password
mpweb.default.domain=OURDOMAIN
########################LDAP PROPERTIES #########################

The application is deployed on JBoss 5.1.0 GA Application Server.

Does anyone have an idea how to make it work on UNIX?

Thanks & Regards

Baba.
-- 
View this message in context: http://old.nabble.com/JCIFS-Authentication-on-UNIX-Box-tp28607638p28607638.html
Sent from the Samba - jcifs mailing list archive at Nabble.com.



More information about the jCIFS mailing list