views:

1335

answers:

3

Hi!

I'm developing a JAVA APP that must run on a Tomcat and I need to be able to identify the remote user who is acceding to my application web.

This remote user is running on a windows, so I need to get his "windows login" (sAMAccountName active directory attribute).

On IIS is easiest. I follow this http://stackoverflow.com/questions/688939/detect-user-logged-on-a-computer-using-asp-net-app to get the user logged

The content of server.xml is:

<Realm
    className="org.apache.catalina.realm.JNDIRealm" debug="99"
    connectionURL="ldap://DAServer:389"
    connectionName="[email protected]"
    connectionPassword="secret"
    referrals="follow"
    userBase="OU=mycompany,DC=mydomain,DC=local"
    userSubtree="true"
    roleBase="OU=groups,DC=mydomain,DC=local"
    roleName="name"
    roleSubtree="true"
    roleSearch="(member={0})"/>

And the content of web.xml is:

<!-- Define a Security Constraint on this Application -->
    <security-constraint>
     <web-resource-collection>
     <web-resource-name>Entire Application</web-resource-name>
      <url-pattern>/*</url-pattern>
     </web-resource-collection>

     <auth-constraint>
      <role-name>myCompany Users</role-name>
     </auth-constraint>
    </security-constraint>

    <!-- Define the Login Configuration for this Application -->
    <login-config>
     <auth-method>BASIC</auth-method>
     <realm-name>myRealm</realm-name>
    </login-config>

    <!-- Security roles referenced by this web application -->
    <security-role>
     <description>The role that is required to log in to APP</description>
     <role-name>myCompany Users</role-name>
    </security-role>

I need Automatic Login.

Thank you!

A: 

you have to use the Tomcat JNDI realm and integrate it with your server's active directory

Try here for some guidelines

Konstantinos
I added more details about my problem
VansFannel
+1  A: 

If you are building an Intranet application and are looking for SSO then you can use something like Jespa which is based on jCIFS.

bmatthews68
Maybe I don't need a new library, I only need to integrate windows authentication like IIS does.
VansFannel
Jespa is NOT based on JCIFS. The JCIFS NTLM HTTP filter is flawed in a number of ways so it is very unfortunate to characterize Jespa in this way. Jespa just uses JCIFS for it's MS-RPC layer and some basic NTLM computations. But the API and functionality bare no resemblance.
Note that jespa is not free.
Thorbjørn Ravn Andersen