You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by appel <ar...@siminn.is> on 2007/08/02 15:42:58 UTC

Simple authentication

Hello,

I need some simple login page for my web. There is only one account, and
I'll probably just hardcode the user/pass in the code.

Can't figure out how to do it properly with the struts2 framework, been
googling and reading the docs... do I need a interceptor for this or?

Thank you!
-- 
View this message in context: http://www.nabble.com/Simple-authentication-tf4206203.html#a11964749
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Simple authentication

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Appel,

appel wrote:
> I need some simple login page for my web. There is only one account, and
> I'll probably just hardcode the user/pass in the code.
> 
> Can't figure out how to do it properly with the struts2 framework, been
> googling and reading the docs... do I need a interceptor for this or?

The easiest thing to use is the authentication built-into your servlet
container. Servlet containers are required to provide
j_security_check-style authentication and authorization. Apache Tomcat,
for instance, allows you to do simple auth using a small XML file
containing all of the account information (username, password, and roles).

The advantages of using this over a hand-rolled (yet simple)
implementation are:

1. Code is less likely to have any bugs.
2. Setup is usually pretty simple if you have limited requirements.
3. Easy to expand to a larger RDBMS-backed user database if/when
   you need to.

I hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGsfIv9CaO5/Lv0PARAuAlAKCf6JDISk8YYDa6jHYp19V3mbORhACgknHZ
OaoW5HWQKQFPQKDHtWvoKhs=
=IFuW
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org