This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
Hmm, OK this could be quite tough (I've never had to do this myself).
It looks like File supports:
Tests whether the application can execute the file denoted by this abstract pathname.
Tests whether the application can read the file denoted by this abstract pathname.
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.