While at first glance, Java people may think of using Java Authentication and Authorization Service (JAAS)¬†as the solution to access a Windows user’s rights if one is part of the Administrator group or not, there is actually a Sun implementation of JAAS in Java’s library jar “rt.jar” with a package name of com.sun.security.auth.

The class is called NTSystem and the method below returns true if the user logged in to the Windows workstation has admin rights or none.

The SID S-1-5-32-544 is the id of the Administrator group in the Windows operating system.

Related Posts Plugin for WordPress, Blogger...