0

As the question say, can I get Windows Username in a GWT-RPC application?

Edit : NOTE: System.getProperty("user.name"); throws error in GWT-RPC

The method getProperty(String) is undefined for the type System

2 Answers2

1

Use System.getProperty("user.name"); that will return the username.

EDIT : What I found is Apache waffle. WAFFLE - Windows Authentication Functional Framework (Light Edition) is a native C# and Java library that does everything Windows authentication (Negotiate, NTLM and Kerberos).

This is one of the example which matches your requirement.

Ritesh Mengji
  • 6,000
  • 9
  • 30
  • 46
  • Thanks for prompt response. Is there any way so that I can ask the user to enter his credentials again when accessing my application? –  Oct 12 '11 at 20:16
0

You can get windows user name by

String userName = System.getProperty("user.name");

Then you can wrap it in your GWT-RPC app.

x.509
  • 2,205
  • 10
  • 44
  • 58
  • Thanks for prompt response. Is there any way so that I can ask the user to enter his credentials again when accessing my application? –  Oct 12 '11 at 20:16
  • could you elaborate? you can always display a pop-up/page/dialog. – x.509 Oct 12 '11 at 20:17
  • Ok these is an intranet application, as long as the user is trying to access the application from a machine that he’s logged in with an account that belongs to a particular group, it should let him in. If the account is not authorized, a message should be shown asking him to contact administrator. Sorry the complete question has been changed now. –  Oct 12 '11 at 20:23
  • so the backend authentication server is ActiveDirectory? or what? – x.509 Oct 12 '11 at 20:26
  • Please have a look at this,. http://mhimu.wordpress.com/2009/03/18/active-directory-authentication-using-javajndi/ – x.509 Oct 12 '11 at 20:30