JNDI + NIS Authentication + Tomcat
Hi, I've run into a bit of a stumbling block attempting to configure a Resource and associated ResourceParams in /etc/tomcat4/server.xml for web based NIS authentication using JAAS's com.sun.security.auth.module.JndiLoginModule. I have written a Principal and CallbackHandler class as well as the configuration file as shown below (with the IPs and NIS domain masked): indexName { com.sun.security.auth.module.JndiLoginModule required debug=true user.provider.url=nis://aaa.bbb.ccc.ddd/DOMAIN group.provider.url=nis://aaa.bbb.ccc.ddd/DOMAIN; }; When I attempt to authenticate via a simple JSP based HTML form, I get the following output from the catalina.out log file: [JndiLoginModule] user provider: nis://aaa.bbb.ccc.ddd/DOMAIN [JndiLoginModule] group provider: nis://aaa.bbb.ccc.ddd/DOMAIN [JndiLoginModule]: User not found javax.naming.NameNotFoundException: Name nis: is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:811) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) at com.sun.security.auth.module.JndiLoginModule.attemptAuthentication(JndiLoginModule.java:497) at com.sun.security.auth.module.JndiLoginModule.login(JndiLoginModule.java:310) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [...snip...] [JndiLoginModule] regular authentication failed [JndiLoginModule]: aborted authentication failed LoginException: User not found I have been scouring the Jakarta Tomcat, Sun, and other sites for information/examples, but have yet to find anything of any help. Does anyone know of any resource that describes how to properly configure this type of web based authentication via Tomcat and com.sun.security.auth.module.JndiLoginModule? Thanks in advance, Michael -- Michael R. Schwab Design Engineer QCC Communications Corp. [EMAIL PROTECTED] Voice: (306) 249-0220 Fax: (306) 249-5128 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: error accessing a context-param from web.xml
Thanks ilis and jon, I'll take a look at JNDI. Michael On Wed, Sep 04, 2002 at 10:34:10AM +0100, jon wingfield wrote: The error you are getting is the JSP parser mistaking the data %= application.getInitParameter( as the value for the driver parameter of the sql:setDataSource tag. Then it reports a parsing error as the next parameter is sees is jdbc.driver with no '=', and hence no value, after it. If you really want to set up a datasource this way try: sql:setDataSource driver='%= application.getInitParameter(jdbc.driver) %' url='%= application.getInitParameter(jdbc.url) %' user='%= application.getInitParameter(jdbc.username) %' password='%= application.getInitParameter(jdbc.password) %' var='db' / Note the single quotes. This should work as there's nothing wrong with how you are accessing the init params. http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html -Original Message- From: Michael R. Schwab [mailto:[EMAIL PROTECTED]] Sent: 03 September 2002 18:56 To: Tomcat Users List Subject: error accessing a context-param from web.xml Hi, I am fairly new to using Tomcat. I am attempting to use a centralized location to define the MySQL access configuration info. It is my understanding that the /WEB-INF/web.xml is the best location to store this info. I have defined a set of JDBC parameters such as the driver info shown below in my web.xml file for the web app: context-param param-namejdbc.driver/param-name param-valuecom.mysql.jdbc.Driver/param-value /context-param ... Within a JSP file, I attempt to get the parameter via the implicit application variable: sql:setDataSource driver=%= application.getInitParameter(jdbc.driver) % url=%= application.getInitParameter(jdbc.url) % user=%= application.getInitParameter(jdbc.username) % password=%= application.getInitParameter(jdbc.password) % var=db / Unfortunately, I receive the following error: org.apache.jasper.compiler.ParseException: /search-all-cables.jsp(10,56) Attribute jdbc.driver has no value at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:563) ... FYI, I am using Tomcat 4.0.4 with J2SDK 1.4.0_01. Thank you, Michael -- Michael R. Schwab Design Engineer QCC Communications Corp. [EMAIL PROTECTED] Voice: (306) 249-0220 Fax: (306) 249-5128 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Michael R. Schwab Design Engineer QCC Communications Corp. [EMAIL PROTECTED] Voice: (306) 249-0220 Fax: (306) 249-5128 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
error accessing a context-param from web.xml
Hi, I am fairly new to using Tomcat. I am attempting to use a centralized location to define the MySQL access configuration info. It is my understanding that the /WEB-INF/web.xml is the best location to store this info. I have defined a set of JDBC parameters such as the driver info shown below in my web.xml file for the web app: context-param param-namejdbc.driver/param-name param-valuecom.mysql.jdbc.Driver/param-value /context-param ... Within a JSP file, I attempt to get the parameter via the implicit application variable: sql:setDataSource driver=%= application.getInitParameter(jdbc.driver) % url=%= application.getInitParameter(jdbc.url) % user=%= application.getInitParameter(jdbc.username) % password=%= application.getInitParameter(jdbc.password) % var=db / Unfortunately, I receive the following error: org.apache.jasper.compiler.ParseException: /search-all-cables.jsp(10,56) Attribute jdbc.driver has no value at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:563) ... FYI, I am using Tomcat 4.0.4 with J2SDK 1.4.0_01. Thank you, Michael -- Michael R. Schwab Design Engineer QCC Communications Corp. [EMAIL PROTECTED] Voice: (306) 249-0220 Fax: (306) 249-5128 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]