• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using Kerberos authentication for authenticating through Domain controller in 2008 environment

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Currently my application is authenticating using NTLM authentication. It authenticates using a Domain Contoller which was residing on 2003 server. Now since it is migrated to 2008, my current NTLM authentication is not working.
I suppose that this would require Kerberos authentication. (Correct me if I am wrong)

My current code with NTLM authentication looks like this. If I just try to replace sPDC value with new server name, it doesnt work. I found several code on net, but did not understand the refrrence. Can anyone provide the easiest way to move to Kerberos with minimal changes in below code.

Note:- I have hard coded few values for easier understanding. Though original code take username, password in form of arguements.




import java.io.IOException;
import java.util.Hashtable;
import java.util.Properties;
import com.linar.jintegra.NTLMAuthenticate;

public class ADAuthenticate
{
private static String sPDC1;
private static String sPDC2;
private static String sPDC3;

public static void main(String[] args)
{
try
{
NTAuthenticate("domainname", "username", "password");
}
catch (SecurityException se)
{

System.out.println(se.getMessage());
}
catch (PDCNotFoundException nfe)
{
System.out.println("Cannot authenticate the user. Unable to find a domain controller.");
}

}


public static void NTAuthenticate(String sDomain, String sUsername, String sPassword) throws SecurityException, ADAuthenticate.PDCNotFoundException
{
try {
sDomain = "domainname";
NTLMAuthenticate.validate(sPDC1, sDomain, sUsername, sPassword);

}
catch (IOException ioe)
{
System.out.println(String.valueOf(new StringBuffer("The First PDC (").append(sPDC1).append(") failed to communicate.")));
try {
NTLMAuthenticate.validate(sPDC2, sDomain, sUsername, sPassword);
}
catch (IOException ioe2)
{
System.out.println(String.valueOf(new StringBuffer("The Second PDC (").append(sPDC2).append(") failed to communicate.")));
try {
NTLMAuthenticate.validate(sPDC3, sDomain, sUsername, sPassword);
}
catch (IOException ioe3)
{
System.out.println(String.valueOf(new StringBuffer("The Third and Final PDC (").append(sPDC3).append(") failed to communicate.")));
throw new PDCNotFoundException();
}
}
}
}

static
{
try
{
Properties p = new Properties();

sPDC1 = "domaincontrollername";
sPDC2 = p.getProperty("auth.pdc2");
sPDC3 = p.getProperty("auth.pdc3");
}

catch (Exception pe)
{
pe.printStackTrace();
System.out.println("Properties file </conf/authenticate/authenticate.properties> not found.");
}
}

public static class PDCNotFoundException extends Exception
{
}
}
 
Divya Deshpande
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all..Any updates on this? I did not find anything much in above url...
 
reply
    Bookmark Topic Watch Topic
  • New Topic