Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / February 2004

Tip: Looking for answers? Try searching our database.

Integrating java security API with host OS

Thread view: 
Boris Bralo - 27 Jan 2004 13:16 GMT
Hi all

I'd like to check if some user can access some file.
This is code snippet (exception handling ommited):
public static void main(String[] args) {

   Subject s = new Subject();

   // AD is configured kerberos login context

    LoginContext lc = new LoginContext("AD",s,new TextCallbackHandler());

    lc.login();

    File f = new File("C:\\bin");

    System.out.println("I  " + (f.canRead() ?"can":"can not" ) + "read" );

   Subject.doAsPrivileged(s, new PrivilegedAction() {

       public Object run() {

               File f = new File("C:\\bin");

               System.out.println("You " + f.canRead());

               return null;

   }

   },null);

}

I managed to logon onto Active Directory OK, but both File.canRead() fails
when snippet is ran with java -Djava.security.manager and pass when ran
without -D....,
regardless of login success.

Any ideas?

---

Boris
Boris Bralo - 16 Feb 2004 12:38 GMT
Hi all,
I've done some research since initial posting and discovered
that I'm on my own and I'll have to wrap native API.

I think that's shame, beacuse java security infrastructure has
very good and complete authentication.  For authorization,
you're left with policy file.

Is there a JCP for this ?

I don't belive that this isn't scratching the itch since, during my
research, I've see all kinds of wierd solutions for this problem. For
example, BEA uses System.exec() to spawn  little utility executable named
wlauth to check permission on host OS. I'm trying to build an app for very
high traffic site, and I'll be so fired if I suggest something like that
:-).

---

Boris

> Hi all
>
[quoted text clipped - 40 lines]
>
> Boris


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.