Click to See Complete Forum and Search --> : File Access Permission / Impersonation as a different user


gvalli
October 5th, 1999, 02:52 PM
I have a server app (written in Java using sockets which runs on a file server. OS could be WinNT/Unix/Linux/Novell) that listens to clients' request from a client app (written in c++ using sockets) and serves them the list files in a given directory.

In other words the server generates and sends a directory listing for given client UserID/Password.

The clients (i.e. user running the client app) have varying degree of access to files in the server.
User Joe can have access to the files a, b and c in the server, but user Jane have access to files a, x, y & z).

I create threads to service multiple requests from clients.

Since the server app has full permission to the file(s) in the server, it will return all the files in a given directory and not just the files that the user/client have access to.
So, is there a way to impersonate as a different user, so that I get only the file that the users have access to?
In Win32, there is a way to create a thread as different user, with different set of privileges etc.,
Does Java have a similar concept?

I have searched in Java API as well as this site and the Java developer connection. There were many questions related to this issue. But none of seems to have the answer.

Thanks in advance,
Ganesan

Axel Goldbach
October 12th, 1999, 03:40 AM
Hi,

I don't know if there's a solution to your problem. But take a look at the SecurityManager and Permission concepts of Java (if you haven't done this before). May you start in the API description with java.lang.SecurityManager.

Hope this helps. Please send me the solution if you got one. I'm interested too.

Bye
Axel.