You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bill Ataras <bi...@ataras.com> on 2003/06/27 02:45:04 UTC
Howto protect a webapp with a form quick and dirty
Keywords: auth form basic howto webapp security AuthType mod_auth
I spent a bunch of time trying to get apache to do this with
mod_auth/mod_jk in httpd.conf and couldn't. Also spent a bunch of time
trying to get BASIC auth working for a webapp with tomcat running behind
apache jkmounts and couldn't. apache 2, tomcat 4.1.24. So I fall back to
FORM. This is merely to get a simple webapp protected. Nothing fancy.
Some day someone will google this up and thank me :)
Here's a quick and dirty how to:
1. Install tomcat
2. Edit conf/server.xml
3. Make sure <Resource name="UserDatabase... is not commented out
4. Make sure <Realm
className="org.apache.catalina.realm.UserDatabaseRealm"... is not
commented out.
5. Edit conf/tomcat-users.xml
6. Add <role rolename="theking"/>
7. Add <user username="dumbuser" password="guessme" roles="theking" />
8. Add the following to your webapp's web.xml file (in proper order,
before env-entry)
<security-constraint>
<web-resource-collection>
<web-resource-name>Test Admin</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>theking</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>My test realm</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/login.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>theking</role-name>
</security-role>
9. Put this login.jsp at the top of your webapp...
<html lang="en">
<head>
<title>Login</title>
</head>
<body>
<form method="POST" action='j_security_check'
name="loginForm">
<input type="text" name="j_username" size="16"
maxlength="16"/><br>
<input type="password" name="j_password" size="16"
maxlength="16"/><br>
<input type="submit" value='Login'/><br>
<input type="reset" value='Reset'/><br>
</form>
</body>
</html>
10. Reboot the world
11. You should get a login form when you hit the webapp. Type in
dumbuser/guessme and you should feel like theking when the app comes up.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Howto compile mod_jk2 under windows?
Posted by Bill Barker <wb...@wilshire.com>.
"John Turner" <to...@johnturner.com> wrote in message
news:oprrffjcucxvhn30@mail.aas.com...
>
> Best place for this is the tomcat-dev list, not tomcat-user.
An even better place is http://nagoya.apache.org/bugzilla/. Sorry, I can't
help. I don't do this sort of stuff in Windows.
>
> John
>
> On Fri, 27 Jun 2003 14:21:23 +0800, Ares Liu <ge...@nst.pku.edu.cn> wrote:
>
> > After I hit build button, the MSVC debug windows displayed as follow:
> >
> > --------------------Configuration: mod_jk2 - Win32
Debug------------------
> >
> >
> > --
> > Creating resources from ..\..\common\jk_logger_win32_message.mc
> > MC: may only specify one message file to compile.
> > MC: may only specify one message file to compile.
> > MC: may only specify one message file to compile.
> > MC: may only specify one message file to compile.
> > Microsoft (R) Message Compiler Version 1.00.5239
> > Copyright (c) Microsoft Corp 1992-1995. All rights reserved.
> > usage: MC [-?vcdwso] [-m maxmsglen] [-h dirspec] [-e extension] [-r
> > dirspec] [-x dbgFileSpec] [-u] [-U] filename.mc
> > -? - displays this message
> > -v - gives verbose output.
> > -c - sets the Customer bit in all the message Ids.
> > -d - FACILTY and SEVERITY values in header file in decimal.
> > Sets message values in header to decimal initially.
> > -w - warns if message text contains non-OS/2 compatible inserts.
> > -s - insert symbolic name as first line of each message.
> > -o - generate OLE2 header file (use HRESULT definition instead of
> > status code definition)
> > -m maxmsglen - generate a warning if the size of any message exceeds
> > maxmsglen characters.
> > -h pathspec - gives the path of where to create the C include file
> > Default is .\
> > -e extension - Specify the extension for the header file.
> > From 1 - 3 chars.
> > -r pathspec - gives the path of where to create the RC include file
> > and the binary message resource files it includes.
> > Default is .\
> > -x pathspec - gives the path of where to create the .dbg C include
> > file that maps message Ids to their symbolic name.
> > -u - input file is Unicode.
> > -U - messages in .BIN file should be Unicode.
> > filename.mc - gives the names of a message text file
> > to compile.
> > Generated files have the Archive bit cleared.
> > Error executing c:\windows\system32\cmd.exe.
> >
> > mod_jk2.dll - 1 error(s), 1 warning(s)
> >
> >
> > --
> > Nuclear Science & Technology Virtual Research Center
> > http://nst.pku.edu.cn
> >
> >
> > ---------- Original Message -----------
> > From: "Bill Barker" <wb...@wilshire.com>
> > To: tomcat-user@jakarta.apache.org
> > Sent: Thu, 26 Jun 2003 22:07:20 -0700
> > Subject: Re: Howto compile mod_jk2 under windows?
> >
> >> I'm neither a Windows user nor a Jk2 user, but just by looking,
> >> there are '.dsp' files under all of server/apache13, server/apache2,
> >> and server/isapi. Assuming that you have MSVC installed, it should be
> >> enough to click on the file and hit the 'build' button.
> >>
> >> "Ares Liu" <ge...@nst.pku.edu.cn> wrote in message
> >> news:20030627022841.M34286@nst.pku.edu.cn...
> >> > I need newest mod_jk2 under windows. But I don't know how to compile
> >> it.
> >> Who
> >> > can give me a tutorial? Thanks!
> >> >
> >> > -Ares
> >> >
> >> > --
> >> > Nuclear Science & Technology Virtual Research Center
> >> > http://nst.pku.edu.cn
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > ------- End of Original Message -------
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>
>
>
> --
> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Howto compile mod_jk2 under windows?
Posted by John Turner <to...@johnturner.com>.
Best place for this is the tomcat-dev list, not tomcat-user.
John
On Fri, 27 Jun 2003 14:21:23 +0800, Ares Liu <ge...@nst.pku.edu.cn> wrote:
> After I hit build button, the MSVC debug windows displayed as follow:
>
> --------------------Configuration: mod_jk2 - Win32 Debug------------------
>
>
> --
> Creating resources from ..\..\common\jk_logger_win32_message.mc
> MC: may only specify one message file to compile.
> MC: may only specify one message file to compile.
> MC: may only specify one message file to compile.
> MC: may only specify one message file to compile.
> Microsoft (R) Message Compiler Version 1.00.5239
> Copyright (c) Microsoft Corp 1992-1995. All rights reserved.
> usage: MC [-?vcdwso] [-m maxmsglen] [-h dirspec] [-e extension] [-r
> dirspec] [-x dbgFileSpec] [-u] [-U] filename.mc
> -? - displays this message
> -v - gives verbose output.
> -c - sets the Customer bit in all the message Ids.
> -d - FACILTY and SEVERITY values in header file in decimal.
> Sets message values in header to decimal initially.
> -w - warns if message text contains non-OS/2 compatible inserts.
> -s - insert symbolic name as first line of each message.
> -o - generate OLE2 header file (use HRESULT definition instead of
> status code definition)
> -m maxmsglen - generate a warning if the size of any message exceeds
> maxmsglen characters.
> -h pathspec - gives the path of where to create the C include file
> Default is .\
> -e extension - Specify the extension for the header file.
> From 1 - 3 chars.
> -r pathspec - gives the path of where to create the RC include file
> and the binary message resource files it includes.
> Default is .\
> -x pathspec - gives the path of where to create the .dbg C include
> file that maps message Ids to their symbolic name.
> -u - input file is Unicode.
> -U - messages in .BIN file should be Unicode.
> filename.mc - gives the names of a message text file
> to compile.
> Generated files have the Archive bit cleared.
> Error executing c:\windows\system32\cmd.exe.
>
> mod_jk2.dll - 1 error(s), 1 warning(s)
>
>
> --
> Nuclear Science & Technology Virtual Research Center
> http://nst.pku.edu.cn
>
>
> ---------- Original Message -----------
> From: "Bill Barker" <wb...@wilshire.com>
> To: tomcat-user@jakarta.apache.org
> Sent: Thu, 26 Jun 2003 22:07:20 -0700
> Subject: Re: Howto compile mod_jk2 under windows?
>
>> I'm neither a Windows user nor a Jk2 user, but just by looking,
>> there are '.dsp' files under all of server/apache13, server/apache2,
>> and server/isapi. Assuming that you have MSVC installed, it should be
>> enough to click on the file and hit the 'build' button.
>>
>> "Ares Liu" <ge...@nst.pku.edu.cn> wrote in message
>> news:20030627022841.M34286@nst.pku.edu.cn...
>> > I need newest mod_jk2 under windows. But I don't know how to compile
>> it.
>> Who
>> > can give me a tutorial? Thanks!
>> >
>> > -Ares
>> >
>> > --
>> > Nuclear Science & Technology Virtual Research Center
>> > http://nst.pku.edu.cn
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> ------- End of Original Message -------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Howto compile mod_jk2 under windows?
Posted by Ares Liu <ge...@nst.pku.edu.cn>.
After I hit build button, the MSVC debug windows displayed as follow:
--------------------Configuration: mod_jk2 - Win32 Debug--------------------
Creating resources from ..\..\common\jk_logger_win32_message.mc
MC: may only specify one message file to compile.
MC: may only specify one message file to compile.
MC: may only specify one message file to compile.
MC: may only specify one message file to compile.
Microsoft (R) Message Compiler Version 1.00.5239
Copyright (c) Microsoft Corp 1992-1995. All rights reserved.
usage: MC [-?vcdwso] [-m maxmsglen] [-h dirspec] [-e extension] [-r dirspec]
[-x dbgFileSpec] [-u] [-U] filename.mc
-? - displays this message
-v - gives verbose output.
-c - sets the Customer bit in all the message Ids.
-d - FACILTY and SEVERITY values in header file in decimal.
Sets message values in header to decimal initially.
-w - warns if message text contains non-OS/2 compatible inserts.
-s - insert symbolic name as first line of each message.
-o - generate OLE2 header file (use HRESULT definition instead of
status code definition)
-m maxmsglen - generate a warning if the size of any message exceeds
maxmsglen characters.
-h pathspec - gives the path of where to create the C include file
Default is .\
-e extension - Specify the extension for the header file.
From 1 - 3 chars.
-r pathspec - gives the path of where to create the RC include file
and the binary message resource files it includes.
Default is .\
-x pathspec - gives the path of where to create the .dbg C include
file that maps message Ids to their symbolic name.
-u - input file is Unicode.
-U - messages in .BIN file should be Unicode.
filename.mc - gives the names of a message text file
to compile.
Generated files have the Archive bit cleared.
Error executing c:\windows\system32\cmd.exe.
mod_jk2.dll - 1 error(s), 1 warning(s)
--
Nuclear Science & Technology Virtual Research Center
http://nst.pku.edu.cn
---------- Original Message -----------
From: "Bill Barker" <wb...@wilshire.com>
To: tomcat-user@jakarta.apache.org
Sent: Thu, 26 Jun 2003 22:07:20 -0700
Subject: Re: Howto compile mod_jk2 under windows?
> I'm neither a Windows user nor a Jk2 user, but just by looking,
> there are '.dsp' files under all of server/apache13, server/apache2,
> and server/isapi. Assuming that you have MSVC installed, it should
> be enough to click on the file and hit the 'build' button.
>
> "Ares Liu" <ge...@nst.pku.edu.cn> wrote in message
> news:20030627022841.M34286@nst.pku.edu.cn...
> > I need newest mod_jk2 under windows. But I don't know how to compile it.
> Who
> > can give me a tutorial? Thanks!
> >
> > -Ares
> >
> > --
> > Nuclear Science & Technology Virtual Research Center
> > http://nst.pku.edu.cn
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
------- End of Original Message -------
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Howto compile mod_jk2 under windows?
Posted by Bill Barker <wb...@wilshire.com>.
I'm neither a Windows user nor a Jk2 user, but just by looking, there are
'.dsp' files under all of server/apache13, server/apache2, and server/isapi.
Assuming that you have MSVC installed, it should be enough to click on the
file and hit the 'build' button.
"Ares Liu" <ge...@nst.pku.edu.cn> wrote in message
news:20030627022841.M34286@nst.pku.edu.cn...
> I need newest mod_jk2 under windows. But I don't know how to compile it.
Who
> can give me a tutorial? Thanks!
>
> -Ares
>
> --
> Nuclear Science & Technology Virtual Research Center
> http://nst.pku.edu.cn
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Howto compile mod_jk2 under windows?
Posted by Ares Liu <ge...@nst.pku.edu.cn>.
I need newest mod_jk2 under windows. But I don't know how to compile it. Who
can give me a tutorial? Thanks!
-Ares
--
Nuclear Science & Technology Virtual Research Center
http://nst.pku.edu.cn
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org