672329 members! Sign up to stay informed.

Sponsored Links


Resources

Enterprise Java
Research Library

Get Java white papers, product information, case studies and webcasts

News News News Messages: 12 Messages: 12 Messages: 12 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

How to Authenticate a Servlet App with Windows Passwords

Posted by: Nitin Bharti on August 16, 2004 DIGG
Chris Maeda looks at an approach for authenticating a servlet app using Windows passwords; he does this using JAAS with the Tagish SSPI-based login module. He walks us through the steps for configuring the Tagish login module and Tomcat.
JAAS with the Tagish SSPI-based login module is the way to go. The Tagish login module is based on the Windows SSPI API, which provides an authentication service for distributed environments using the best available protocol; i.e. it uses Kerberos when that is available and transparently falls back on NTLM when Kerbos is not available. In addition, SSPI returns the group membership information, which is necessary for servlet apps that use security roles and security constraints.

The first step in setting this up is to configure the Tagish login module according to the instructions that come with it. In a nutshell, the steps are as follows:

- Put NTSystem.dll somewhere on your path
- Put tagishauth.jar on your classpath
- Copy the tagish.login file to $JAVA_HOME/jre/lib/security
- Add this line:
login.config.url.1=file:${java.home}/lib/security/tagish.login to your java.security file (in $JAVA_HOME/jre/lib/security)
Read How to Authenticate a Servlet App with Windows Passwords

Threaded replies

·  How to Authenticate a Servlet App with Windows Passwords by Nitin Bharti on Mon Aug 16 17:01:47 EDT 2004
  ·  Why bother? by Martin Crawford on Tue Aug 17 15:35:50 EDT 2004
    ·  Why bother? by javier castanon on Tue Aug 17 19:20:16 EDT 2004
    ·  Why bother? by Patrice Matignon on Tue Aug 17 19:21:44 EDT 2004
  ·  Thank You! by Gary Steinmetz on Tue Aug 17 17:07:22 EDT 2004
  ·  Simple Method by Stephen Duncan on Tue Aug 17 19:17:38 EDT 2004
    ·  Simple Method by Nuno Ferreira on Mon Sep 05 10:08:48 EDT 2005
  ·  Wedgetail JCSI by Sean Sullivan on Tue Aug 17 21:26:27 EDT 2004
  ·  don't fall back by Mike Stanley on Wed Aug 18 08:57:25 EDT 2004
    ·  please server side by Mike Stanley on Wed Aug 18 08:58:04 EDT 2004
  ·  Alternative for non-Windows AS: LDAP bind > PDC by Mike Finn on Thu Aug 19 23:55:32 EDT 2004
  ·  A simple and portable solution by Thierry Danard on Thu Aug 26 22:47:54 EDT 2004
  ·  How to Authenticate a Servlet App with Windows Passwords by jerome petit on Tue Feb 22 16:57:01 EST 2005
  Message #134498 Post reply Post reply Post reply Go to top Go to top Go to top

Why bother?

Posted by: Martin Crawford on August 17, 2004 in response to Message #134314
http://jcifs.samba.org/src/docs/ntlmhttpauth.html

DLLs and native libraries suck! There is a pure Java implementation of the NTLM authentication protocol here implemented as a Filter to boot!

  Message #134514 Post reply Post reply Post reply Go to top Go to top Go to top

Thank You!

Posted by: Gary Steinmetz on August 17, 2004 in response to Message #134314
This is one of those things (like form uploads), that many need but (suprisingly) isn't standardized. Any help is appreciated.

  Message #134524 Post reply Post reply Post reply Go to top Go to top Go to top

Simple Method

Posted by: Stephen Duncan on August 17, 2004 in response to Message #134314
I'll definitely have to try out this method (as well as the Samba NTLM link mentioned in the article).

But here's what I do for now: use the IIS-Tomcat connector, use Integrated Authentication on the directory for the context of the webapp, and route all requests through a default.asp file that forces the authentication to happen, and then use getRemoteUser to get the user data. Everything else is done just through talking LDAP to Active Directory to get user information. I'm not trying to use Group membership information, however.

  Message #134525 Post reply Post reply Post reply Go to top Go to top Go to top

Why bother?

Posted by: javier castanon on August 17, 2004 in response to Message #134498
DLLs and native libraries suck!
In many cases the main disadvantage of solutions using native libraries is they aren't portable, i.e when you have an app server running on a Linux box. Anyway perhaps this little DLL doesn't cause any problems with other apps in your windows server, but the same can be said about pure Java solutions, that have a vast amount of dependencies and obscure JARs to add to your classpath.

Authentication against a Windows mechanism should have a clear and easy to find example in http://java.sun.com. The example of course exist, but it is buried in the JNDI tutorial (follow it step by step and voilá) But if you need to authenticate against a Windows NT mechanism (NTLM), your good luck is over, which is unfortunate for those that still have to support NT domains. Therefore I agree any information in this regard is welcome.

  Message #134527 Post reply Post reply Post reply Go to top Go to top Go to top

Why bother?

Posted by: Patrice Matignon on August 17, 2004 in response to Message #134498
There is a pure Java implementation of the NTLM authentication protocol here implemented as a Filter to boot!
Samba's jCIFS supports only NTLM (i.e. NT4), and not Kerberos (win2K) unless I am mistaken.

  Message #134537 Post reply Post reply Post reply Go to top Go to top Go to top

Wedgetail JCSI

Posted by: Sean Sullivan on August 17, 2004 in response to Message #134314
Is anybody using Wedgetail's product?

http://www.wedgetail.com/jcsi/kerberos/index.html

http://www.wedgetail.com/jcsi/sso/index.html

  Message #134589 Post reply Post reply Post reply Go to top Go to top Go to top

don't fall back

Posted by: Mike Stanley on August 18, 2004 in response to Message #134314
IMHO, You should *know* definitevly what domain you will be authenticating against. Authentication domains should not fall back transparently. Its cool to provide multiple authentication backends, but this should not be transparent to the applciation. Different idenity/credentials may(should) yeild different levels of authorization and that is something that should be left up to the application.

<br><br>
I apologize if this is addressed in the configuration. I haven't looked at it. This is merely in response to the vocabulary used in the post.

  Message #134590 Post reply Post reply Post reply Go to top Go to top Go to top

please server side

Posted by: Mike Stanley on August 18, 2004 in response to Message #134589
add a preview button :-)

  Message #134961 Post reply Post reply Post reply Go to top Go to top Go to top

Alternative for non-Windows AS: LDAP bind > PDC

Posted by: Mike Finn on August 19, 2004 in response to Message #134314
Not exactly single-sign-on with automatic passing of workstation credentials, but we used this approach below to authenticate web and Swing client users (client on any platform; app server on Linux). Users still have to enter login and password for the app, but at least it's the one they use for workstation login.

We wrote a custom JAAS login module that authenticates against a PDC/SDC using a regular old LDAP bind w/ password (to port 389 on the DC). Bind with user@domain. Then, once bound, if need be, you can even query user groups/props/attrs LDAP-style.

The not-insignificant downside is that the password goes cleartext over the LAN/WAN - likely a problem in some shops. Otherwise, it works like a champ. And, not sure if LDAP is open out-of-the-box default on a DC or not.

Mike

  Message #135870 Post reply Post reply Post reply Go to top Go to top Go to top

A simple and portable solution

Posted by: Thierry Danard on August 26, 2004 in response to Message #134314
Authentication filters are easy to setup, but the problem is implenting a sign-out.

Implementing a Windows-based authentication in Java is very simple with JCIFS:


import jcifs.UniAddress;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbSession;
import java.net.InetAddress;

...

InetAddress ip = InetAddress.getByName("192.168.0.1."); // ip address of your windows controller
UniAddress myDomain = new UniAddress(ip);
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("MYDOMAIN", "mylogin", "mypasword");
SmbSession.logon(myDomain, auth);

If an exception is thrown, the controller didn’t like the login and the password.

An HTML form will suffice to grab the "login" and "password". However, it is recommended to use HTTPS instead of HTTP between the web browser and the HTTP server.

  Message #158033 Post reply Post reply Post reply Go to top Go to top Go to top

How to Authenticate a Servlet App with Windows Passwords

Posted by: jerome petit on February 22, 2005 in response to Message #134314
To authenticate users via NTLM using JAAS on any platform,
try this :
http://www.jaaslounge.org/

JaasLounge is an open-source implementation of platform-independent JAAS login modules.

The first release offers JAAS NTLM authentication via JCIFS.

  Message #183566 Post reply Post reply Post reply Go to top Go to top Go to top

Simple Method

Posted by: Nuno Ferreira on September 05, 2005 in response to Message #134524
I also use IIS-Tomcat connector in my projects. Could you explain me in more detail how do you do Integrated Authentication with IIS-Tomcat connector? You can email me: nrsimoes@hotpop.com. Thanks.

New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com

Dependency Injection in Java EE 6 - Part 2

Reza Rahman continues to explore the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6. (January 21, Article)

Ted Neward Q&A: What you must know about JavaScript, Scala and more

Ted Neward is an independent consultant specializing in high-scale enterprise systems, and an authority in Java and .NET technologies. He is the author and co-author of several books, including Effective Enterprise Java. At TheServerSide Java Symposium in March, he will be presenting sessions on pragmatic architecture, ECMAScript and Scala. (January 15, Article)

Developers split on open sourcing Java

Now that Oracle is absorbing Sun Microsystems, there mixed views on what should come of the Java Community Process (JCP). While some say Oracle should become the new steward of Java and keep the JCP much as it was, others argue that it may be time to open-source this widespread language. (November 24, Article)

Dependency Injection in Java EE 6 - Part 1

Reza Rahman explores the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6. (November 2, Article)

SAML: It's Not just for Web services

SAML is an XML-based standard for exchanging authentication and authorization data between security domains. The single most important problem that SAML was created to solve is the Web browser Single Sign-On problem. Many organizations are debating whether to stay with version 1.1 or move to 2.0. This article makes observations about both options. (September 28, Article)

Programming is Also Teaching Your Team

Joe Ottinger takes a look at how people learn, and applies it to the practice of programming. He notes that understanding how people learn is an essential part of working in a programming team. (September 22, Article)

Can Java EE Deliver The Asynchronous Web?

Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies. (July 14, Article)

JSF Flex

JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags. (June 29, Article)

The Rules of SOA - A Road to a Successful SOA Implementation

In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project. (June 23, Tech Talk)

Ari Zilka Talks About Terracotta 3.1

Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now. (June 15, Tech Talk)

Enterprise Application Integration, and Spring

In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements. (June 15, Tech Talk)

Google Web Toolkit: An Introduction

In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls. (June 4, Tech Talk)

Just Enough Early Architecture to Guide Development

Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable. (May 28, Tech Talk)

Productive Programmer: On the Lam from the Furniture Police

This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work. (May 26, Tech Talk)

Auto-Scaling Your Existing Web Application

Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers. (May 21, Tech Talk)

Automating Hibernate Mapping and Queries For Java Web Development

Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application. (May 19, Article)

Free Book PDF Download: Mastering EJB Third Edition

Mastering EJB was one of the original and most influential EJB books in the industry. Mastering EJB III now returns with two new expert co-authors, updated for EJB 2.1 and 30% new chapters including security, integration, best practices, open source, and more.
(Book PDF Download)

Application Server Matrix

The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
Java Solutions
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map