• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Configuration of filter problem

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am trying to configure the authentication filter for the entire project, but its not working.


When I replace the project name with one of the folders in the project, it works.

Thanks

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Try changing the url-pattern like below :

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohamed Inayath wrote:Try changing the url-pattern like below :


NO!!!

That will cause the filter to be executed for all requests, including images, JavaScript files, CSS style sheets and so on. Never map "/*"!

What is "FORMS" in this case? (all uppercase? not usually done.)
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

if



This one execute for all your patterns then you can use extension behind it like...




or another *.jsp or aother............

 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.

FORMS is the project name. I want the filter to be excuted for all pages. Maybe using *.jsp will help.

Also when the user first hits a url if he/she is not authenticated (checked in the filter) I would like to redirect to the login page.
How can make the login page submit to the filter?

Thanks

 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Justin Howard wrote:FORMS is the project name.


"project name" has no meaning in this context. What is its function in the URL? Is it a folder name? The context path? And why is it capitalized?

I want the filter to be excuted for all pages. Maybe using *.jsp will help.

Really? What about the login page?

How can make the login page submit to the filter?

Not sure what you are asking. You don't submit to a filter, you submit to a resource like a servlet or JSP.

basically, your filter should perform the authentication check (but not for pages that don't need to be authenticated, like the login page) and continue on if all is well, but redirect to the login page if not. The login page should submit to its action that checks the credentials and sets up the session, then traverses to the "main page" of the app (where the filter will check the session for valid authentication).
 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this in my login page.


and this in the filter mapping



Why wont this work?

I have the authntication code in the filter.



I am trying to do some.jsp --> filter->(not authenticated)---> login.jsp-->filter-->(authenticated)-->some.jsp
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It there any common url pattern when you call jsp ?
or in filter you can check getRequestURI and if it is css or js etc..ignore it.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Manish Wadhwani wrote:or in filter you can check getRequestURI and if it is css or js etc..ignore it.


It's a poor practice to incur the overhead of this for each and every request. Rather, configure your patterns wisely and filter only those requests that require it.
 
Why should I lose weight? They make bigger overalls. And they sure don't make overalls for tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic