aspose file tools*
The moose likes Java in General and the fly likes File folder access through java with user name/password authentication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "File folder access through java with user name/password authentication" Watch "File folder access through java with user name/password authentication" New topic
Author

File folder access through java with user name/password authentication

Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

Hi Ranchers,

Here is my requirement, I have to search file folders with provided user credentials. I am deploying my application in a server, where I have a folder which has permissions for user1, and not for user2. By default File class uses java's permission for that folder to access it. How can I tie this up with authentication?

Thanks in advance.

Regards
Ananth Chellathurai


Ananth Chellathurai [Walk on software]
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

How is the permissioning implemented on the folders for User1 and user2, is this on a *IX box?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

I am not clear on what an *IX box is?
Permission implemented on a file folder for local or domain users.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Sorry about that, *IX = UNIX or LINUX, are you running on windows?
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

My requirement is for both linux and windows. And thats the reason for picking Java, platform independent. Its ok to have extra bit of code for various OS but need some clue on how to do it.


Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

OK, next question is, what version of the JDK are you using? My understanding is that 1.6+ makes this alot easier.
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

I am using java 1.6 update 10
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hmm, OK this could be quite tough (I've never had to do this myself).

It looks like File supports:

boolean canExecute()
Tests whether the application can execute the file denoted by this abstract pathname.
boolean canRead()
Tests whether the application can read the file denoted by this abstract pathname.
boolean canWrite()
Tests whether the application can write the file denoted by this abstract pathname.

Problem is that by default your user will be the user running the java process.

Going _completely_ out on a limb here, could you perhaps spawn off a small java app that is run by the actual user you want to test the permissions against? Not sure if that would work.

Anyone else? This is out of my area of expertise!
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

Is there any API, that could help me do this. Any help? Is it not possible to do this at all.!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File folder access through java with user name/password authentication