You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rajesh Kalluri <rk...@manduca.com> on 2002/07/24 18:09:59 UTC

Container Managed Authentication - Form based login

Hi All,

I have set up container managed authentication with tomcat with form based
login.

<login-config>
    		<auth-method>FORM</auth-method>
    		<form-login-config>
    			<form-login-page>/LoginForm.html</form-login-page>
    			<form-error-page>/LoginError.html</form-error-page>
    		</form-login-config>
</login-config>

-The entry point to my app is LoginForm.html.

<form method="POST" action="j_security_check">

      Username: <input type="text" name="j_username"><br />
      Password: <input type="password" name="j_password"><br />
	  <br />

      <input type="submit" value="Login">
      <input type="reset" value="Reset">

</form>.

I let Tomcat take care of authenticating the users password and his role.

I want to store the user profile including his email and some other
information from the database into session scope based on <%=
request.getRemoteUser() %>.

At what stage is it recomended to do this in a struts application using
contianer managed authentication.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: org.apache.struts.actions.ReloadAction - Where is it in 1.1

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 24 Jul 2002, Rajesh Kalluri wrote:

> Date: Wed, 24 Jul 2002 16:15:57 -0400
> From: Rajesh Kalluri <rk...@manduca.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> Subject: org.apache.struts.actions.ReloadAction - Where is it in 1.1
>
> Does any body know what happened to reload action in struts 1.1 or where i
> can find it.
>
> org.apache.struts.actions.ReloadAction.
>

It's not possible for a web application to completely reload everything
you would need (for example, new or updated Action classes), so it's been
abandoned.  Use the application reload facilities of your container
instead (such as reload="true" on Tomcat).

> Regards
> Rajesh

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


org.apache.struts.actions.ReloadAction - Where is it in 1.1

Posted by Rajesh Kalluri <rk...@manduca.com>.
Does any body know what happened to reload action in struts 1.1 or where i
can find it.

org.apache.struts.actions.ReloadAction.

Regards
Rajesh


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Container Managed Authentication - Form based login

Posted by Filipe Mateus <fi...@fbn.ca>.
You should code your own Realm and refer to it in server.xml.  Container-managed app will use this custom-realm to authenticate the user.  Warning: this works in Tomcat only!  (I'm not sure if version 3 supports it though).

On Wed, 24 Jul 2002 12:09:59 -0400
"Rajesh Kalluri" <rk...@manduca.com> wrote:

> Hi All,
> 
> I have set up container managed authentication with tomcat with form based
> login.
> 
> <login-config>
>     		<auth-method>FORM</auth-method>
>     		<form-login-config>
>     			<form-login-page>/LoginForm.html</form-login-page>
>     			<form-error-page>/LoginError.html</form-error-page>
>     		</form-login-config>
> </login-config>
> 
> -The entry point to my app is LoginForm.html.
> 
> <form method="POST" action="j_security_check">
> 
>       Username: <input type="text" name="j_username"><br />
>       Password: <input type="password" name="j_password"><br />
> 	  <br />
> 
>       <input type="submit" value="Login">
>       <input type="reset" value="Reset">
> 
> </form>.
> 
> I let Tomcat take care of authenticating the users password and his role.
> 
> I want to store the user profile including his email and some other
> information from the database into session scope based on <%=
> request.getRemoteUser() %>.
> 
> At what stage is it recomended to do this in a struts application using
> contianer managed authentication.
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


**********************************************************************
Financiere Banque Nationale et NBCN n'assument
aucune responsabilite quant a la confidentialite et l'integrite du
present courriel en raison des risques d'interception inherents 
a l'Internet. Pour cette raison, toute opinion exprimee au terme 
des presentes ne reflete pas necessairement celle de 
Financiere Banque Nationale et de NBCN.
**********************************************************************
Due to the security risks involved in sending information over the
Internet, National Bank Financial  and NBCN cannot be held responsible 
for ensuring the confidentiality and integrity of the present e-mail. For this 
reason, the opinions expressed herein do not necessarily reflect those of 
National Bank Financial and NBCN.
**********************************************************************


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


still problems with null pointer exception in validator.validate..

Posted by "SATISH.T" <sa...@wipro.com>.
Hi 
Was just trying to implement a similar example as given in
struts-validator package 
I get the following problem when I try to call myForm.validate method
where myform extends from ValidatorForm.
I have configured the validatorServlet to load my validation.xml and
validator-rules.xml  in my applications web.xml  properly.
Can some one tell me why such an exception occurs.
Regards
Satish 

java.lang.NullPointerException
        at org.apache.commons.validator.Validator.validate(Unknown
Source)
        at
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java
:281)
        at
com.satish.myproj.SaveRegistrationAction.perform(SaveRegistrationActi
on.java:65)
        at org.apache.struts.action.Action.execute(Action.java:369)
        at
org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:437)
        at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:264)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:110
9)
        at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:470)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:247)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:243)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:190)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2347)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:180)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
rValve.java:170)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:170)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
468)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:174)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

        at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
r.java:1027)
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
va:1125)
        at java.lang.Thread.run(Thread.java:484)


Re: null pointer exception in org.apache.commons.validator.Validator.validate

Posted by Raghavendra Shenoy <ra...@hotmail.com>.
i worked  with this long back  ..


public ActionErrors validate(ActionMapping mapping,HttpServletRequest
request)
{
    ActionErrors errors = new ActionErrors();
    /*
    */
 return errors
}
just comment this in u r form class ... try debugging from there on ...


just check u r validation.xml file , all the field validation , property
fields of the form ....

Thanks and Regards

Raghavendra Shenoy


----- Original Message -----
From: "SATISH.T" <sa...@wipro.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Thursday, July 25, 2002 1:57 AM
Subject: null pointer exception in
org.apache.commons.validator.Validator.validate


>
> Hi
> I was trying to use the validator framework of struts, was trying to do
> something similar to the example given in struts validator package . I
> get the following null pointer exception. Can some one tell me  why such
> an exception occurs  , unable to find a way to debug either. Any help
> would be greatly appreciated.
> Regards
> Satish
>
> In my action class, when I call myForm.validate(mapping,request)  ,
> myForm extends Validator Form, I get the following exception.
> java.lang.NullPointerException
>
>         at org.apache.commons.validator.Validator.validate(Unknown
> Source)
>         at
> org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java
> :269)
>         at
> com.satish.myproj.SaveRegistrationAction.perform(SaveRegistrationActi
> on.java:65)
>         at org.apache.struts.action.Action.execute(Action.java:369)
>         at
> org.apache.struts.action.RequestProcessor.processActionPerform(Reques
> tProcessor.java:437)
>         at
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
> va:264)
>         at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:110
> 9)
>         at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:470)
>
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:247)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:193)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> alve.java:243)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
> .java:566)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> a:472)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> alve.java:190)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
> .java:566)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> a:472)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>
>         at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
> 2347)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
> ava:180)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
> .java:566)
>         at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
> rValve.java:170)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
> .java:564)
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
> ava:170)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
> .java:564)
>         at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
> 468)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
> .java:564)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> a:472)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
> ve.java:174)
>         at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
> .java:566)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> a:472)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>
>         at
> org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
> r.java:1027)
>         at
> org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
> va:1125)
>         at java.lang.Thread.run(Thread.java:484)
>
>


----------------------------------------------------------------------------
----


> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


null pointer exception in org.apache.commons.validator.Validator.validate

Posted by "SATISH.T" <sa...@wipro.com>.
Hi 
I was trying to use the validator framework of struts, was trying to do
something similar to the example given in struts validator package . I
get the following null pointer exception. Can some one tell me  why such
an exception occurs  , unable to find a way to debug either. Any help
would be greatly appreciated. 
Regards
Satish
 
In my action class, when I call myForm.validate(mapping,request)  ,
myForm extends Validator Form, I get the following exception.
java.lang.NullPointerException

        at org.apache.commons.validator.Validator.validate(Unknown
Source)
        at
org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java
:269)
        at
com.satish.myproj.SaveRegistrationAction.perform(SaveRegistrationActi
on.java:65)
        at org.apache.struts.action.Action.execute(Action.java:369)
        at
org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:437)
        at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:264)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:110
9)
        at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:470)
 
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:247)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:243)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:190)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 
        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2347)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:180)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
rValve.java:170)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:170)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
468)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:174)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 
        at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
r.java:1027)
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
va:1125)
        at java.lang.Thread.run(Thread.java:484)


Re: Container Managed Authentication - Form based login

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Rajesh" == Rajesh Kalluri <rk...@manduca.com> writes:

    Rajesh> Hi All,
    Rajesh> I have set up container managed authentication with tomcat with form based
    Rajesh> login.

    Rajesh> <login-config>
    Rajesh>     		<auth-method>FORM</auth-method>
    Rajesh>     		<form-login-config>
    Rajesh>     			<form-login-page>/LoginForm.html</form-login-page>
    Rajesh>     			<form-error-page>/LoginError.html</form-error-page>
    Rajesh>     		</form-login-config>
    Rajesh> </login-config>

    Rajesh> -The entry point to my app is LoginForm.html.

    Rajesh> I let Tomcat take care of authenticating the users password and his role.

    Rajesh> I want to store the user profile including his email and some other
    Rajesh> information from the database into session scope based on <%=
    Rajesh> request.getRemoteUser() %>.

    Rajesh> At what stage is it recomended to do this in a struts application using
    Rajesh> contianer managed authentication.

I'm not certain what you mean by "stage", but by the way you phrase this, I
think you might misunderstand a little bit about how CMA works.

By specifying a "login-config" element and a "security-constraint" element, you
ensure that the URL patterns specified in the security-constraint will be
"protected" by CMA.  You don't "call" the login process at any point, and you
certainly don't make your login page the "entry point" of your application.

In addition, if you implement a proper JAAS configuration file, you specify how
the container obtains authentication information to compare against what the
user provided.  You can also use the Tomcat-specific "realm" concept, but this
isn't portable to other application servers.

(And by the way, don't make the silly mistake of specifying a "url-pattern" in
your "web-resource-collection" that is matched by the path to your login or
error page.  You'll get a glorious infinite loop, or an exception, if the app
server is smart enough.)

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>