• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How would you design this??

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an application which uploads files via a web form, and stores information about the files (size, path info etc.) in a db2 table, and then writes the files to a directory in the file system. Users can download these files via links displayed in a jsp. My problem is how to limit access to the files to only the correct group of users, since the files with technically lie outside the application in a different directory. There is no problem limiting access to the jsps which display the links, but there is nothing to stop a user (who has the right url) from accessing the files directly. Currently the application uses a .htaccess file and leaves it up to the web server to limit access to the files, but this approach is only good for one group of users. We need something more dynamic where different users will have access to different files. Any suggestions are appreciated!
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you give the users NO access to the actual file directory and download the files through a servlet? That changes the files from static content to dynamic content. Then the servlet could check user roles or permissions against attributes in your file meta-data before downloading.
 
Steve Fording
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes that might be a possibility. How would you go about downloading the files using a servlet?
 
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you would set a value in the link and catch that in the doPost, doGet methods. You would then map that 'key' to that actual location, in the file system, of the file.
 
My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic