User authentication against WinNT: Tagish JAAS Modules
If your Java application needs to authenticate users against a Windows NT or Windows 2000 domain, take a look at JAAS Modules from free.tagish.net. By installing a small DLL - NTSystem.dll - in your system (the computer which is running your app) and a jar file - tagishauth.jar - you can authenticate users as easily as the following example:
public static void checkAuth(String userName, char[] password, String domainName) throws javax.security.auth.login.LoginException {
com.tagish.auth.win32.NTSystem ntSystem = new NTSystem();
ntSystem.logon(userName, password, domainName);
System.out.println("User validated using domain login");
}
You just have to pass the user name, password, and the NT domain to perform the authentication. When the authentication fails, a LoginException is thrown.
public static void checkAuth(String userName, char[] password, String domainName) throws javax.security.auth.login.LoginException {
com.tagish.auth.win32.NTSystem ntSystem = new NTSystem();
ntSystem.logon(userName, password, domainName);
System.out.println("User validated using domain login");
}
You just have to pass the user name, password, and the NT domain to perform the authentication. When the authentication fails, a LoginException is thrown.
2 Comments:
Hi,
I tried the same, but it was working only for admin users.
Let me know if it is possible for non-admin users also.
Thanks,
Bhaskaran
This comment has been removed by a blog administrator.
Post a Comment
<< Home