• 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

Authonticate User name/passwrod against Active directory

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have my application on Solaris with Tomcat. Now I want to do following things:

when this application starts prompt user for his user name/password, if they typed these matching the ones in Active Directory (the users run this application on window XP on company's hosted active directory) then user should be allowed in to run the application. This is an extra layer of protection - as if someone left his computer on, no one in his absence should be able to use it since he was logged in first at the begin of day etc.

Really I am looking for a way to authintiacte a user against Active Directory usernames/password then creating another list of Oracle users in our database. I have following code but does not work, do I need to do some changes in Tomcat to make it work. I am totally in new area here,help.:


<%@ page import="javax.naming.*" %>
<%@ page import="javax.directory.*" %>
<p><h1>Network Windows USERNAME without any login (ie)</h1></p>
<%
try
{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");

env.put(Context.PROVIDER_URL,
"ldap://" + getProperty("SERVER") + ":" +
getProperty("PORT"));

env.put(Context.SECURITY_PRINCIPAL,
getProperty("USER_RDN") + "," +
getProperty("BASE_DN"));
env.put(Context.SECURITY_CREDENTIALS,
getProperty("USER_PASSWORD"));

DirContext ctx = new InitialDirContext(env);

ctx.getAttributes(getProperty("BASE_DN"));

ctx.close();

info("connection_succeeded");
}
catch (CommunicationException comEx)
{
error(MessageResource.getMessage("communication_exception",
comEx.getMessage()));
return false;
}
catch (AuthenticationException authEx)
{
error(MessageResource.getMessage("authentication_exception",
authEx.getMessage()));
return false;
}
catch (NamingException nameEx)
{
error(MessageResource.getMessage("naming_exception",
nameEx.toString()));
return false;
}

return true;

%></BODY>

Any ideas?
 
Raj Puri
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any help pl?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic