There is a jsp based form login example in the "examples" directory. That whole 
directory over to your servlet directory,
change the login-config to use form based login (look at the example in 
~/webapps/examples/WEB-INF/web.xml) This is a copy and paste trick -- nothing else.

so...

mkdir ~/webapps/<myservlet-home>/jsp

// this is all you need
cp ~/webapps/examples/jsp/security ~/webapps/<myservlet-home>/jsp

hack this into the appropriate portion of !/webapps/<myservlet-home>/WEB-INF/web.xml

    <login-config>
      <auth-method>FORM</auth-method>
      <realm-name>Form based login</realm-name>
      <form-login-config>
        <form-login-page>/jsp/protected/login.jsp</form-login-page>
        <form-error-page>/jsp/protected/error.jsp</form-error-page>
      </form-login-config>
    </login-config>


//and comment out the BASIC login-config using <!--  -->

restart!

easy as pie!

This even does session caching for you!

Chris

-----Original Message-----
From: EDV Systembetrieb [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 18, 2001 10:37 AM
To: [EMAIL PROTECTED]
Subject: Form based Authentication / j_security_check not found


Hi everybody again.
I'm getting mad on configuring tomcat for my application.
My be I do not know enough about java, but I have to "Learn it by doing", so please be 
friendly.

I'm using form-based authentication and everything works until I submit my login-ID
If I put LoginForm.html in the servlet-dir, it pops-up, but after entering my 
login-infos I get 
"The requested URL /DSCservlet/j_security_check was not found on this server".
I know, LoginForm.html should be outside the protected area.
But in my special example, something seems wrong with alias in mod_jk.conf and/or some 
path in my config-files.
I searched the mailing-list, but I do not understand the stuff.
Please help before I'm getting mad

Thanks Sabine

my apps-DSC.xml:
<webapps>
        <Context path="/DSCservlet"
                docBase="/webapps/SSL_apps/dsc/servlet"
                debug="0"
                crossContext="false"
                reloadable="true" >
        </Context>
</webapps>


my mod_jk.conf
...
Alias /DSCservlet "/webapps/SSL_apps/dsc/servlet"
<Directory "/webapps/SSL_apps/dsc/servlet">
    Options Indexes FollowSymLinks
</Directory>
JkMount /DSCservlet/servlet/* ajp13
JkMount /DSCservlet/*.jsp ajp13
<Location "/DSCservlet/WEB-INF/">
    AllowOverride None
    deny from all
</Location>
<Location "/DSCservlet/META-INF/">
    AllowOverride None
    deny from all
</Location>

/webapps/SSL_apps is HTTPS-protected by apache and document-root

/webapps/SSL_apps/dsc/upload.htm is my page for selecting files for upload. After 
that, a login-screen should appear (it does).
This page calls a servlet with 
<form action="/DSCservlet/servlet/FileUpload.UploadServlet" 
enctype="MULTIPART/FORM-DATA" method="post" name ="EnterFiles">

Also in this directory "dsc" are the following files

ResultPageFooter.htm
ResultPageHeader.htm
servlet
servlet/LoginError.html
servlet/LoginForm.html
servlet/META-INF
servlet/META-INF/MANIFEST.MF
servlet/WEB-INF
servlet/WEB-INF/web.xml
servlet/WEB-INF/classes
servlet/WEB-INF/classes/FileUpload
servlet/WEB-INF/classes/FileUpload/FileUploader.class
servlet/WEB-INF/classes/FileUpload/FileUploadException.class
servlet/WEB-INF/classes/FileUpload/Message.class
servlet/WEB-INF/classes/FileUpload/UploadServlet.class
servlet/WEB-INF/classes/properties
servlet/WEB-INF/classes/properties/FileUpload.properties
servlet/WEB-INF/classes/properties/FileUploadMessages.properties
servlet/WEB-INF/classes/properties/FileUploadMessages_en.properties

my web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>
<web-app>
        <servlet>
                <servlet-name>UploadServlet</servlet-name>
                <servlet-class>FileUpload.UploadServlet</servlet-class>
        </servlet>
        <security-constraint>
                <web-resource-collection>
                        <web-resource-name>DSC</web-resource-name>
                        <url-pattern>/*</url-pattern>
                        <http-method>POST</http-method>
                        <http-method>GET</http-method>
                </web-resource-collection>
                <auth-constraint>
                        <role-name>er_kunden</role-name>
                </auth-constraint>
                <user-data-constraint>
                     <transport-guarantee>CONFIDENTIAL</transport-guarantee>
                </user-data-constraint>
        </security-constraint>
        <login-config>
                <auth-method>FORM</auth-method>
                <realm-name>Eingangsregistratur DSC</realm-name>
                <form-login-config>
                        <form-login-page>/LoginForm.html</form-login-page>
                        <form-error-page>/LoginError.html</form-error-page>
                </form-login-config>
        </login-config>
</web-app>





--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to