Get login username in java -
How do I get a username / login name in Java?
I have tried this ...
try {login contact lc = new loginContax (app, name, new text call handler ()); Lc.login (); Subject matter = lc.getSubject (); Principal Principal [] = (Principal []) subject. GateParipal () Toure (new principal [0]); (INTI = 0; I LT; principal length; I ++) {if (principal [i] NTUser principal for example] Principal [i] instance of unix principal) {string log inusername name = principal ] .getName (); }}} Hold (with security exception) {System.out.println ("Security Exception:" + se.getMessage ()); } I get a security exposure while trying to run this code. Can someone tell me whether I am going in the right direction and understanding the problem Help me
System.getProperty ("user.name")
Comments
Post a Comment