Re: Host appBase vs Context docBase

2014-07-05 Thread Neeraj Sinha
Normally,we configure docBase when we want the application to be resided on
a separate directory and not inside tomcat. So, when you use docBase I
don't think you need to configure host/appbase as well.
Appbase folders go under tomcat directory parallel to default appbase
webapps. Each appbase is mapped to a particular host so we configure more
than one appbases when we want to have applications running under different
hosts deployed in the same tomcat.

On Jul 5, 2014 7:35 AM, Igal @ getRailo.org i...@getrailo.org wrote:

 I'm a little confused about the Host appBase attribute.

 Let's say that my website resides in D:\www\site1

 I don't like using {Tomcat}/webapps so I don't want to have it as a base
directory for websites.  What I've been doing so far is create an empty
folder alongside webapps, named empty, and use it as appBase, e.g.

 Host name=Site1 appBase=empty unpackWARs=false autoDeploy=false
   !-- this works but what's the deal with appBase? !--
   Context path=/ docBase=D:/www/site1 /
 /Host

 But it feels like I'm doing something wrong.  I expect this to work, but
it doesn't:

 Host name=Site1 appBase=D:/www/site1 unpackWARs=false
autoDeploy=false
   !-- this doesn't work !--
 /Host

 Can anyone explain why the snippet above doesn't work, and if that is the
way it should be, then what is the purpose of Host/appBase?

 TIA

 --
 Igal Sapir
 Railo Core Developer
 http://getRailo.org/


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org



Getting host name inside tomcat realm implementation

2014-06-24 Thread Neeraj Sinha
I am using form based authentication (tomcat 7.0.34) and I have the
implementation of custom realm class which extends RealmBase class. Inside
the getPrincipal() method implementation, I am calling backend service to
save some login details. I need to pass host name to backend (I have 2
applications running under different hosts connected to same DB, so to know
the login source of user). Hosts are configured in server.xml.

Any help/links/URL much appreciated.

Neeraj


Re: Catalina start problem

2014-04-08 Thread Neeraj Sinha
Guys,


On 4 April 2014 20:05, Christopher Schultz ch...@christopherschultz.netwrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Neeraj,

 On 4/4/14, 3:46 AM, Neeraj Sinha wrote:
  On 3 April 2014 23:06, Christopher Schultz
  ch...@christopherschultz.netwrote:
 
  Neeraj,
 
  On 4/2/14, 4:23 AM, Neeraj Sinha wrote:
  I am trying to start tomcat on linux and I am getting
  LifecycleException exception whose snippet is below:
 
  Apr 2, 2014 8:33:53 AM
  org.apache.catalina.core.AprLifecycleListener init INFO: The
  APR based Apache Tomcat Native library which allows optimal
  performance in production environments was not found on the
  java.library.path:
 
 
 /usr/java/jdk1.6.0_38/jre/lib/amd64/server:/usr/java/jdk1.6.0_38/jre/lib/amd64:/usr/java/jdk1.6.0_38/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
 
 
 
 
 Apr 2, 2014 8:33:53 AM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler [http-bio-8080] Apr 2,
  2014 8:33:53 AM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler [ajp-bio-8009] Apr 2,
  2014 8:33:53 AM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 890 ms Apr 2, 2014 8:33:53
  AM org.apache.catalina.startup.Catalina start SEVERE:
  Catalina.start: org.apache.catalina.LifecycleException:
  Failed to start component [StandardServer[8005]] at
  org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
 
 
 
 
 at org.apache.catalina.startup.Catalina.start(Catalina.java:684)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
  Method) at
 
 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 
 
 
 
 at
 
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 
 
 
 
 at java.lang.reflect.Method.invoke(Method.java:597)
  at
  org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
 
 
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:451)
  Caused by: java.lang.NoSuchMethodError:
  org.apache.naming.NamingContext.setExceptionOnFailedWrite(Z)V
  at
 
 
 org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:264)
 
 
 
 
 at
 
 
 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 
 
 
 
 at
 
 
 org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
 
 
 
 
 at
 
 
 org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:724)
 
 
 
 
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  ... 7 more Apr 2, 2014 8:33:53 AM
  org.apache.catalina.startup.Catalina start INFO: Server
  startup in 6 ms
 
  One reason I could guess for this is that Tomcat jar may not
  be proper but I have checked that and that looks fine to me.
 
  Appreciated if somebody could help me.
 
  What version of Tomcat are you trying to run? Have you modified
  your Tomcat installation other than changes to server.xml and
  adding web applications to it? Do any of your web applications
  have any Tomcat JAR files in them?
 
  Thanks. I am using version 7.0.34. I have not modified anything in
  tomcat installation but I have added JBoss client jars in
  /tomcat/lib   which is required for web apps to access EJB
  services.

 This is almost certainly the problem. Which JARs did you add?

  Actually, I have this tomcat installed and running in few other
  environments also without any problem. I am trying to setup this on
  a new system where I copied the complete tomcat and apache files
  from one of the environment and modified their configuration files
  for domain and host configuration. Apart from this no other
  changes.

 You really shouldn't mix libraries from other containers into Tomcat's
 lib/ directory. JBoss uses Tomcat internally as its servlet container,
 so mixing those libraries can seriously confuse things -- as you've seen.

  Yesterday, I tried to install from a fresh tomcat build and I
  started getting the earlier mentioned exceptions when I added the
  required Jboss client jars. So, this means that Jboss jars might
  have same class which catalina.jar have but I am wondering howcome
  same setup is working fine for other environments.

 I'm just going to go ahead and say that this is not a supported
 configuration and leave it at that. It could take a while to figure
 out the exact combination of offending libraries and classes, but it's
 just not worth it: you need to change the way you deploy.

 If you need EJB and don't want to use JBoss, consider using TomEE: it
 uses Tomcat as its servlet container and provider DJB support using
 OpenEJB. So if you're looking for something lighter than JBoss, take a
 look at TomEE.

 - -chris


   Thanks for your suggestion. The issue is fixed. There were few
additional Jboss jars apart from Jboss-client jars which was causing the
 issue. readme.txt file of Jbossall-client.jar suggest what all jars should
be used

Re: Catalina start problem

2014-04-04 Thread Neeraj Sinha
Chris,


On 3 April 2014 23:06, Christopher Schultz ch...@christopherschultz.netwrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Neeraj,

 On 4/2/14, 4:23 AM, Neeraj Sinha wrote:
  I am trying to start tomcat on linux and I am getting
  LifecycleException exception whose snippet is below:
 
  Apr 2, 2014 8:33:53 AM
  org.apache.catalina.core.AprLifecycleListener init INFO: The APR
  based Apache Tomcat Native library which allows optimal performance
  in production environments was not found on the java.library.path:
 
 /usr/java/jdk1.6.0_38/jre/lib/amd64/server:/usr/java/jdk1.6.0_38/jre/lib/amd64:/usr/java/jdk1.6.0_38/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
 
 
 Apr 2, 2014 8:33:53 AM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler [http-bio-8080] Apr 2, 2014
  8:33:53 AM org.apache.coyote.AbstractProtocol init INFO:
  Initializing ProtocolHandler [ajp-bio-8009] Apr 2, 2014 8:33:53
  AM org.apache.catalina.startup.Catalina load INFO: Initialization
  processed in 890 ms Apr 2, 2014 8:33:53 AM
  org.apache.catalina.startup.Catalina start SEVERE: Catalina.start:
  org.apache.catalina.LifecycleException: Failed to start component
  [StandardServer[8005]] at
  org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
 
 
 at org.apache.catalina.startup.Catalina.start(Catalina.java:684)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 
 
 at
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 
 
 at java.lang.reflect.Method.invoke(Method.java:597)
  at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
  at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:451)
  Caused by: java.lang.NoSuchMethodError:
  org.apache.naming.NamingContext.setExceptionOnFailedWrite(Z)V at
 
 org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:264)
 
 
 at
 
 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 
 
 at
 
 org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
 
 
 at
 
 org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:724)
 
 
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  ... 7 more Apr 2, 2014 8:33:53 AM
  org.apache.catalina.startup.Catalina start INFO: Server startup in
  6 ms
 
  One reason I could guess for this is that Tomcat jar may not be
  proper but I have checked that and that looks fine to me.
 
  Appreciated if somebody could help me.

 What version of Tomcat are you trying to run? Have you modified your
 Tomcat installation other than changes to server.xml and adding web
 applications to it? Do any of your web applications have any Tomcat
 JAR files in them?

 - -chris


  Thanks. I am using version 7.0.34. I have not modified anything in tomcat
installation but I have added JBoss client jars in /tomcat/lib   which is
required for web apps to access EJB services. Actually, I have this tomcat
installed and running in few other environments also without any problem. I
am trying to setup this on a new system where I copied the complete tomcat
and apache files from one of the environment and modified their
configuration files for domain and host configuration. Apart from this no
other changes. Yesterday, I tried to install from a fresh tomcat build and
I started getting the earlier mentioned exceptions when I added the
required Jboss client jars. So, this means that Jboss jars might have same
class which catalina.jar have but I am wondering howcome same setup is
working fine for other environments.

-- Neeraj

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 Comment: GPGTools - http://gpgtools.org
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

 iQIcBAEBCAAGBQJTPZwDAAoJEBzwKT+lPKRYICEQALVfnTT7vGzt1ICafuznVYn1
 Wz778Ij8WtbY8FDDfvtJREyf+4Xcw1YAsQa4acSkjmFRZW9AHE+BMFs82dYiVO3q
 9XktiZOGJ1cfc2WqGD4NlRIC4u0lnPJau0js/vf2je3fd61sixh5+r7Lwftp7fQ1
 9QsAEIZG3XHmrEVVrw1iMwm5fEAPSokBJX6Dxe2SA3hmKddgME2lYuenZLuiVjmm
 OQyntOdMlrSLQGQdBNbdR3cLSoDbLXTXkGCWy5/Xsjn9inKXC2fZdbzqShwT3+C6
 o9nbpzLjM2l1EHnig+qYw9oEUhEAfdohtk3h2csJsIpX/Qndh2PnoeuGdmBRC+B0
 UDGFDOMhx3HLjbK9Lvt86q7LL5ZCeNQPCe/3OpcgsV8OST1wO3mFcwoBPQhFSkks
 pIlSu9t9NkbWBQf9TiFxVPl2YG3byvdgTT/puN094HN+Swbt7OZ7aRUIuisDEl6Q
 I7qetrOTh4O29mLBs2YHYx9UmMbbtXNR+ODppzD7CmHqIFWVparDPTFHgdqAT8ES
 Bj9QMUKZ5uCCL0/KpR0M6swBNeeu1k0OCvLjrE536KUSTv9LQnltDRv+xSrHnnp3
 FUSnWYFRGP8w1t07LQ2e6JGd5/YoEUEVcldfh9wx4hks/+XEx2/bR/gRHmHPLz7j
 mejeP0348u/4sRBOfeqq
 =UiH3
 -END PGP SIGNATURE-

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




Catalina start problem

2014-04-02 Thread Neeraj Sinha
I am trying to start tomcat on linux and I am getting LifecycleException
exception whose snippet is below:

Apr 2, 2014 8:33:53 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal
performance in production environments was not found on the
java.library.path:
/usr/java/jdk1.6.0_38/jre/lib/amd64/server:/usr/java/jdk1.6.0_38/jre/lib/amd64:/usr/java/jdk1.6.0_38/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Apr 2, 2014 8:33:53 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler [http-bio-8080]
Apr 2, 2014 8:33:53 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler [ajp-bio-8009]
Apr 2, 2014 8:33:53 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 890 ms
Apr 2, 2014 8:33:53 AM org.apache.catalina.startup.Catalina start
SEVERE: Catalina.start:
org.apache.catalina.LifecycleException: Failed to start component
[StandardServer[8005]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.startup.Catalina.start(Catalina.java:684)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:451)
Caused by: java.lang.NoSuchMethodError:
org.apache.naming.NamingContext.setExceptionOnFailedWrite(Z)V
at
org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:264)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:724)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Apr 2, 2014 8:33:53 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6 ms

One reason I could guess for this is that Tomcat jar may not be proper but
I have checked that and that looks fine to me.

Appreciated if somebody could help me.


Re: Passing additional parameters using j_security_check (Form based authentication)

2014-03-26 Thread Neeraj Sinha
On 12 March 2014 20:40, Christopher Schultz ch...@christopherschultz.netwrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Neeraj,

 On 3/12/14, 10:47 AM, Neeraj Sinha wrote:
 Thanks. Actually in the realm implementation, I make a call to backend
 authenticate () method which validates various login rules and if any of
 them fails, it returns false and the user is not allowed to login
 (GenericPrincipal object is instantiated with an invalid role) and is
 re-directed to login page. One of the rule is user account locking rule so
 user can not be authenticated successfully unless his/her user account is
 unlocked first so this solution won't work.

 Then you'll have to do your own partial authentication, process the
 reset code, then perform *formal* authentication (using
 request.authenticate()), then forward to wherever users should go
 after they reset their passwords.

 - -chris


   Chris,

   Thanks. What I am doing now is that I am processing the unlock code and
re-directing the request to my login page along with get parameter as
status based on which a message is displayed if the unlock was successful
and further allows user to login. Although the earlier implementation was
not like this but I have seen in couple of applications where this approach
is followed.


 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 Comment: GPGTools - http://gpgtools.org
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

 iQIcBAEBCAAGBQJTIHjsAAoJEBzwKT+lPKRYNo4P/jOQiQWlVFVu51i5KnpBGV5W
 HtjjnpJC6qU5Bu+MNqB2qcBeCJ6lTmlFZQ9fRSjL3CmDfkgBlApIoPebICMdGEoF
 wa9rNJljfkoUtUFpeas91rUwXXPYcKrlXFxelpemCHVu6EfoEVaFQh1s71e/gZrJ
 R5pkKSy4CWJxZ1R4GjuXadry39OvB5cjlnmLz8NpaNa337HrBe8EzsK/hmFBJjGB
 fUKORbxMszctpqzrQyaaRxkPwxw5duz8VaJ8kwimYXsMP4NmiNuX1xN8cDqxzJ2Z
 J23yqq0S9tIHbpGRIg867IHhbtSSyPv6tIihXdPZoNz7YwU9d7t8I0vut5c8kOzw
 JN5/wayIacqJTMuOHdwRr+n6RMw+RDgDMnlAXI/caUbXabCbdORDoo1CQlTs3wVv
 HeR0skCsRx2qDEnrLpnxrlrFwVbQiHBOpOH2yLi414YXdT203ndkmn9nSzCjOM5X
 uLF0yS2Q3MymFmJxaJrvmZwozf+LsNSUlTeVi+VQT7TSYHpL0CM15aCK+TCoYNtm
 bDsVNXoNKbsljGQzAO5iCPKdkQ845xBpMgl7uCrBA9bZT3hQXj8GcnZyBGyfsTYr
 TfhwzZK7DsA/lWXj3Bue50cv2w7pQUeo2FGjAGqkoYn4jwIIU7YlmnhKyMhSky+x
 OZXFwWvSplgE5F9zLBIP
 =iCrm
 -END PGP SIGNATURE-

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Regards,
Neeraj


Re: Passing additional parameters using j_security_check (Form based authentication)

2014-03-12 Thread Neeraj Sinha
Hi Chris,


On 12 March 2014 00:37, Christopher Schultz ch...@christopherschultz.netwrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Neeraj,

 On 3/8/14, 2:06 AM, Neeraj Sinha wrote:
  Chris,
 
  On 7 March 2014 21:43, Christopher Schultz
  ch...@christopherschultz.netwrote:
 
  Neeraj,
 
  On 3/6/14, 4:34 AM, Neeraj Sinha wrote:
  I have a jsp application and my tomcat version is 7.0.34.
  Authentication is done using *Form based authentication.*
 
  My requirement is as follows:
 
  When user's account gets locked, he has to send a unlock
  request and he gets a link in his registered email id
  clicking on which takes him to unlocking page(let's say
  *unlock.jsp*) which has 3 fields namely*username*, *password*
  and *unlock_code* and a submit button. After submission, once
  unlocked successfully the user should land to home page of
  the application.

 How are you checking the username and password? If you are letting
 Tomcat check that, you could make unlock.jsp protected so that the URL
 points to https:///unlock.jsp?code=[unlock_code]. After
 authentication, Tomcat will redirect the user to the original URL --
 which will include the unlock code.


 Thanks. Actually in the realm implementation, I make a call to backend
 authenticate () method which validates various login rules and if any of
 them fails, it returns false and the user is not allowed to login
 (GenericPrincipal object is instantiated with an invalid role) and is
 re-directed to login page. One of the rule is user account locking rule so
 user can not be authenticated successfully unless his/her user account is
 unlocked first so this solution won't work.




 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 Comment: GPGTools - http://gpgtools.org
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

 iQIcBAEBCAAGBQJTH18KAAoJEBzwKT+lPKRYXLQP/AzuccE3pEzq5yF4zCWnAZLf
 VFdzsBJSbIt+C0CJyAffQ7UCRzVEZDJuAFVF12AhRcfdOUbn3N85QLUHPJoWHo0y
 +EbwSc951iRgzeMexp6EgB9DfdltelxCt9gXmAdvpZ91jPAldyVPA6spAdlkUixh
 +hcz9JqVMcILhN0tU35NilqbxYMRRQiserGHXffyRoH5KkWyeACLDrYICLgW8ylg
 2yIPtAkKv+Qr3CRintvGnBHVxf5WCQ76e4vo8dd81PC0Ds/KfNJ5qeSFPnIVND6V
 KmA46lfpxezT0BOFV3OSRzsTDRJ2T7ZeyjPcbSknm+2SqLIhS0L0zLLF9S/4FFr2
 qxIXeZV+AnVqPZBHCNhgCMGoK71recUULRqPcrWPpowgwom/rGyuzyuHD1epADa4
 2Uumcw6DcbK6bhkDTFC+5wzeIFdddVKMP546FL3QeY6OlfnUyR8RE7WjqxXgVDOO
 Opti4wN7CHhEo9CzS4+IAOkJsghqXiiemuZvUgKcAuS5O5DiBiEtuc6uiDpT4H3S
 CaVEvhLX5VrJhD2ZkM2vZQS3v45BTSEmhr5EswE3n9/vknrRV1Vyh+nuyx/RoiIc
 M5id1+Gm/bS/3wVfcVrEyIavgwdj9gK9Lwl0DhexlWq4HCUVqRCsaNBcRR9qY/Tc
 jEU85sGWpjuH1N8vhhLJ
 =HOx2
 -END PGP SIGNATURE-

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




-- 
Regards,
Neeraj


Re: Passing additional parameters using j_security_check (Form based authentication)

2014-03-07 Thread Neeraj Sinha
Chris,

On 7 March 2014 21:43, Christopher Schultz ch...@christopherschultz.netwrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 Neeraj,

 On 3/6/14, 4:34 AM, Neeraj Sinha wrote:
  I have a jsp application and my tomcat version is 7.0.34.
  Authentication is done using *Form based authentication.*
 
  My requirement is as follows:
 
  When user's account gets locked, he has to send a unlock request
  and he gets a link in his registered email id clicking on which
  takes him to unlocking page(let's say *unlock.jsp*) which has 3
  fields namely*username*, *password* and *unlock_code* and a submit
  button. After submission, once unlocked successfully the user
  should land to home page of the application.
 
  Just to let you know, the main login page of the application is
  *login.jsp* which is configured in *web.xml *and it is called
  whenever any protected resource is requested. It has username and
  password fields and it's action is *j_security_check*.
 
  Now my problem is how to pass unlock_code, the 3rd parameter of
  *unlock.jsp* to *FormAuthenticator *using the action
  *j_security_check*?
 
  I have implementations of *authenticate* method in *LockOutRealm*
  where I would have liked to first check if unlock_code is not null
  and then if yes then would have called backend service to unlock
  the user first(which would have also checked the password matching
  part) and then would have made a call to instantiate
  *UserPrincipal*. I have the implementation of *getPrincipal* method
  in another custom realm.
 
  Is there anyway to pass other parameters apart from username and
  password to
  *FormAuthenticator*(org.apache.catalina.authenticator.FormAuthenticator)?
 
   Quick help/Any reference related to this scenario would be
  appreciated.

 This is not possible using Tomcat's built-in authenticators.

 This is something that is possible using securityfilter (a separate,
 open-source product you can find here:
 http://securityfilter.sourceforge.net/)

 It's a bit out of date but it works quite well. You can handle
 drive-by logins (those without an initial request to a protected page)
 and you can allow pass-through request parameters that will be sent-on
 to the post-login page as you are requesting.

 - -chris


  Thanks. Actually I knew about the Securityfilter but probably it doesn't
support single sign-on several web application contexts. I need
  to have single sign-on feature as well.

  - - Neeraj


 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 Comment: GPGTools - http://gpgtools.org
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

 iQIcBAEBCAAGBQJTGfAnAAoJEBzwKT+lPKRYk54QAKEM5C7qdy8ClEabhE3JmUIY
 B/7N6cABjoSXM41NutlxPKydlS09rTaYwKsDjb79m+K5RwH2r0Czd71DIZ6gyLxK
 X1UTrpxttZaiD/X83mngT4aYj+Rna/3zpJDLSXkdG3Ey0Od8SL8WAQEFP81VRD9x
 xHos3FHca/NzrzPvVx4Vm49OhItntAHjOxQce788r6HGDLvYMbbOH/s8M0nFel2v
 zd5YckVk/pxuGnVPBoXCLKjHw1CyOVZPlSCmjzBOgQWvfaTZtSCkU3CrF1EY5kdj
 i9wl/QEgWZYDSTxD8YFHe1ciZXsGGtNc2lo+6pvm7jJ9fpnTZ71oIj7PB0atpv0O
 79iTzHjnDx1TNM3TTrsCqGy9vFG7X3+F2hCwo9a/C8F1hdVgQvMdt/3ICMh4PWT7
 +r5ZcikBW+SgW3RWepaE2WLEmlXicWsuyTp5oMu3lcczjxw0terXItjH5vB26ahE
 04aw9VIOwxX1JMvvIKXDDirZZ4J6ngcZcvxBMEG5p1J1CVm0lnt/8DteNDolxhpk
 PVSm3I8j/CsRRoQDqEJn7kAti1tgnC85Noh+XEVyjdkPsAau4xr5dZR4fPc00Qby
 b3/B08nCHAKfywM67ZUiJS0F2AA+n7IW+Mufs1ClM1qUkjD8xtjadtbijeiD/1xa
 yhv59uhy1sYcBs7PmYan
 =XzKe
 -END PGP SIGNATURE-

 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




Passing additional parameters using j_security_check (Form based authentication)

2014-03-06 Thread Neeraj Sinha
I have a jsp application and my tomcat version is 7.0.34. Authentication is
done using *Form based authentication.*

My requirement is as follows:

When user's account gets locked, he has to send a unlock request and he
gets a link in his registered email id clicking on which takes him to
unlocking page(let's say *unlock.jsp*) which has 3 fields namely*username*,
*password* and *unlock_code* and a submit button. After submission, once
unlocked successfully the user should land to home page of the application.

Just to let you know, the main login page of the application is
*login.jsp* which
is configured in *web.xml *and it is called whenever any protected resource
is requested. It has username and password fields and it's action is
*j_security_check*.

Now my problem is how to pass unlock_code, the 3rd parameter of *unlock.jsp*
 to *FormAuthenticator *using the action *j_security_check*?

I have implementations of *authenticate* method in *LockOutRealm* where I
would have liked to first check if unlock_code is not null and then if yes
then would have called backend service to unlock the user first(which would
have also checked the password matching part) and then would have made a
call to instantiate *UserPrincipal*. I have the implementation of
*getPrincipal* method in another custom realm.

Is there anyway to pass other parameters apart from username and password
to *FormAuthenticator*(org.apache.catalina.authenticator.FormAuthenticator)?

Quick help/Any reference related to this scenario would be appreciated.