You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Phani Madgula <ph...@gmail.com> on 2007/01/31 10:42:40 UTC

Can we create a filter for j_security_check service in Geronimo Tomcat?

Hi
I have a web application that uses FORM login. I would like to have a filter
to be declared for j_security_check service so that I can perform some
loging tasks. Is it allowed in Geronimo/Tomcat?

I tried with the below tags but filter will not be called..! Any help on
this?

<filter>
<filter-name>Page Request Timer</filter-name>
<filter-class>TimeTrackFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Page Request Timer</filter-name>
<url-pattern>j_security_check</url-pattern>
</filter-mapping>

Regards
Phani

Re: Can we create a filter for j_security_check service in Geronimo Tomcat?

Posted by Paul McMahan <pa...@gmail.com>.
Geronimo delegates filter handling to tomcat, and tomcat does not
support filtering on j_security_check.  See
http://marc2.theaimsgroup.com/?l=tomcat-user&m=107558949928823&w=2

Their recommendation is to use a valve, which Geronimo supports via
the <valve-chain> element in web deployment plan.  However, taking
that approach may not be totally straight forward since after taking a
quick look it seems that the class implementing the valve must be
available in the tomcat container's classloader.  i.e. just including
the class in your webapp is not enough since it's in a separate
classloader.  The reusable valves in the org.apache.catalina.valves
package should be accessible in the tomcat container's classloader.
And AccessLogValve, in particular, may provide what you need.

Best wishes,
Paul

On 1/31/07, Phani Madgula <ph...@gmail.com> wrote:
> Hi
> I have a web application that uses FORM login. I would like to have a filter
> to be declared for j_security_check service so that I can perform some
> loging tasks. Is it allowed in Geronimo/Tomcat?
>
> I tried with the below tags but filter will not be called..! Any help on
> this?
>
> <filter>
> <filter-name >Page Request Timer</filter-name>
>  <filter-class>TimeTrackFilter</ filter-class>
> </filter>
> < filter-mapping>
> <filter-name>Page Request Timer </filter-name>
> <url-pattern >j_security_check</url-pattern>
> </ filter-mapping>
>
>
> Regards
> Phani

Re: Can we create a filter for j_security_check service in Geronimo Tomcat?

Posted by sumedha rubasinghe <su...@wso2.com>.
Hi Phani,
Onces the login completes successfully (i.e. after going through 
j_security_check) , you can get the user name by calling 
httpRequest.getUserPrinciple().
If I understand your requirement correctly... you can use this username 
to for logging..etc..
/sumedha



Phani Madgula wrote:
> Paul,
>  
> To put the issue correctly, I need to access user credentials in my 
> servlet while using Container managed authentication say FORM login. 
> This is required because, I need them for some loging/establishing DB 
> connections etc. Ofcourse, If we use programatic authentication, it 
> can't be done easily.
>  
> In my first mail, I was trying to use a filter for j_security_check so 
> that, I can hook some code there to perform the tasks. However, I was 
> not able to do so.
>  
> I will try your option.
>
> Thx
> Phani
>  
> On 2/2/07, *Vamsavardhana Reddy* <c1vamsi1c@gmail.com 
> <ma...@gmail.com>> wrote:
>
>     Phani,
>
>     What kind of logging are you looking at?
>
>     Vamsi
>
>     On 1/31/07, *Phani Madgula* < phanibalaji.madgula@gmail.com
>     <ma...@gmail.com>> wrote:
>
>         Hi
>         I have a web application that uses FORM login. I would like to
>         have a filter to be declared for j_security_check service so
>         that I can perform some loging tasks. Is it allowed in
>         Geronimo/Tomcat?
>          
>         I tried with the below tags but filter will not be called..!
>         Any help on this?
>          
>         <filter>
>         <filter-name >Page Request Timer</filter-name>
>         <filter-class>TimeTrackFilter</ filter-class>
>         </filter>
>         < filter-mapping>
>         <filter-name>Page Request Timer </filter-name>
>         <url-pattern >j_security_check</url-pattern>
>         </ filter-mapping>
>
>         Regards
>         Phani
>
>
>


Re: Can we create a filter for j_security_check service in Geronimo Tomcat?

Posted by Vamsavardhana Reddy <c1...@gmail.com>.
Phani,

Look at "GERONIMO-1592 Add NamedUPCredentialLoginModule to Console Realm
Wizard".  You can add a NamedUPCredentialLoginModule to the security realm.
(Admin Console in G1.2 (and above) provides an option to add a
NamedUPCredentialLoginModule while creating a security realm.  The fix is
also integrated into G1.1 branches, but, post G1.1.1 release).  This will
make the username and password saved under privateCredentials in the subject
and can be retrieved once authentication completes.

Thanks and best regards,
Vamsi

On 2/6/07, Phani Madgula <ph...@gmail.com> wrote:
>
> Paul,
>
> To put the issue correctly, I need to access user credentials in my
> servlet while using Container managed authentication say FORM login. This is
> required because, I need them for some loging/establishing DB connections
> etc. Ofcourse, If we use programatic authentication, it can't be done
> easily.
>
> In my first mail, I was trying to use a filter for j_security_check so
> that, I can hook some code there to perform the tasks. However, I was not
> able to do so.
>
> I will try your option.
>
> Thx
> Phani
>
> On 2/2/07, Vamsavardhana Reddy <c1...@gmail.com> wrote:
> >
> > Phani,
> >
> > What kind of logging are you looking at?
> >
> > Vamsi
> >
> > On 1/31/07, Phani Madgula < phanibalaji.madgula@gmail.com> wrote:
> > >
> > > Hi
> > > I have a web application that uses FORM login. I would like to have a
> > > filter to be declared for j_security_check service so that I can perform
> > > some loging tasks. Is it allowed in Geronimo/Tomcat?
> > >
> > > I tried with the below tags but filter will not be called..! Any help
> > > on this?
> > >
> > > <filter>
> > > <filter-name >Page Request Timer</filter-name>
> > > <filter-class>TimeTrackFilter</ filter-class>
> > > </filter>
> > > < filter-mapping>
> > > <filter-name>Page Request Timer </filter-name>
> > > <url-pattern >j_security_check</url-pattern>
> > > </ filter-mapping>
> > >
> > > Regards
> > > Phani
> > >
> >
> >
>

Re: Can we create a filter for j_security_check service in Geronimo Tomcat?

Posted by Phani Madgula <ph...@gmail.com>.
Paul,

To put the issue correctly, I need to access user credentials in my servlet
while using Container managed authentication say FORM login. This is
required because, I need them for some loging/establishing DB connections
etc. Ofcourse, If we use programatic authentication, it can't be done
easily.

In my first mail, I was trying to use a filter for j_security_check so that,
I can hook some code there to perform the tasks. However, I was not able to
do so.

I will try your option.

Thx
Phani

On 2/2/07, Vamsavardhana Reddy <c1...@gmail.com> wrote:
>
> Phani,
>
> What kind of logging are you looking at?
>
> Vamsi
>
> On 1/31/07, Phani Madgula <ph...@gmail.com> wrote:
> >
> > Hi
> > I have a web application that uses FORM login. I would like to have a
> > filter to be declared for j_security_check service so that I can perform
> > some loging tasks. Is it allowed in Geronimo/Tomcat?
> >
> > I tried with the below tags but filter will not be called..! Any help on
> > this?
> >
> > <filter>
> > <filter-name >Page Request Timer</filter-name>
> > <filter-class>TimeTrackFilter</ filter-class>
> > </filter>
> > < filter-mapping>
> > <filter-name>Page Request Timer </filter-name>
> > <url-pattern >j_security_check</url-pattern>
> > </ filter-mapping>
> >
> > Regards
> > Phani
> >
>
>

Re: Can we create a filter for j_security_check service in Geronimo Tomcat?

Posted by Vamsavardhana Reddy <c1...@gmail.com>.
Phani,

What kind of logging are you looking at?

Vamsi

On 1/31/07, Phani Madgula <ph...@gmail.com> wrote:
>
> Hi
> I have a web application that uses FORM login. I would like to have a
> filter to be declared for j_security_check service so that I can perform
> some loging tasks. Is it allowed in Geronimo/Tomcat?
>
> I tried with the below tags but filter will not be called..! Any help on
> this?
>
> <filter>
> <filter-name >Page Request Timer</filter-name>
> <filter-class>TimeTrackFilter</ filter-class>
> </filter>
> < filter-mapping>
> <filter-name>Page Request Timer </filter-name>
> <url-pattern >j_security_check</url-pattern>
> </ filter-mapping>
>
> Regards
> Phani
>