You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mi...@ubsw.com on 2003/04/23 13:38:28 UTC

Unit testing FORM based authentication?

How do I unit test FORM based authentication?

-------------------------
Thank You 
Mick Knutson 
Sr. Designer - Project Trust 
aUBS AG, Financial - Zürich 
Office: +41 (0)1/234.42.75 
Internal: 48194 
Mobile: 079.726.14.26 
-------------------------



Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.


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


Re: Unit testing FORM based authentication?

Posted by Max Cooper <ma...@maxcooper.com>.
It isn't for unit testing, but I commonly use curl to send an HTTP
request for/to j_security_check for my app with appropriate j_username
and j_password parameters (they might need to be POSTed). As long as I
share the cookies with later requests I make with curl, I will be logged
in.

I imagine the same technique could be used with any unit test tool that
makes HTTP requests (HTTPUnit?) and manages cookies. You could test for
403 errors for pages your test users are not authorized to view, or
normal (200) responses for pages they are allowed to see.

-Max

On Wed, 2003-04-23 at 04:38, Mick.Knutson@ubsw.com wrote:
> How do I unit test FORM based authentication?
> 
> -------------------------
> Thank You 
> Mick Knutson 
> Sr. Designer - Project Trust 
> aUBS AG, Financial - Zürich 
> Office: +41 (0)1/234.42.75 
> Internal: 48194 
> Mobile: 079.726.14.26 
> -------------------------
> 
> 
> 
> Visit our website at http://www.ubswarburg.com
> 
> This message contains confidential information and is intended only 
> for the individual named.  If you are not the named addressee you 
> should not disseminate, distribute or copy this e-mail.  Please 
> notify the sender immediately by e-mail if you have received this 
> e-mail by mistake and delete this e-mail from your system.
> 
> E-mail transmission cannot be guaranteed to be secure or error-free 
> as information could be intercepted, corrupted, lost, destroyed, 
> arrive late or incomplete, or contain viruses.  The sender therefore 
> does not accept liability for any errors or omissions in the contents 
> of this message which arise as a result of e-mail transmission.  If 
> verification is required please request a hard-copy version.  This 
> message is provided for informational purposes and should not be 
> construed as a solicitation or offer to buy or sell any securities or 
> related financial instruments.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
-- 
Max Cooper <ma...@maxcooper.com>


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