Accessing the current user login

44 views
Skip to first unread message

dao

unread,
Oct 1, 2007, 12:19:26 PM10/1/07
to Google Web Toolkit
hello,

my question may be weird for people coming from the web side.
However, I develop a GWT application inside a company. The users have
to be authenticated to access the facilities. To do that, I could have
created a login page, with "yet an other password". But I dont want
the user log into its unix session or windows session, and again in
the web Application.

The session I want to use is based on the login of the current user:
either the NT account either the unix one.

So, is it possible to get the current windows or unix login with GWT
(as in java, you have the java.user.name property). I did not find
anything about it.

thank's

Chad Bourque

unread,
Oct 1, 2007, 12:32:34 PM10/1/07
to Google-We...@googlegroups.com
dao,
 
I do that here. I use jCIFS (http://jcifs.samba.org/). I use version 1.2.13 (it was the latest when I started using it). And to make it work, I include the jar file in my project and add a filter section to my web.xml file which you can see an example of mine here (http://www.charisacademy.com/GWT/web.xml.htm).
 
And to get the username, on the server side, I have this type of code:
 

package com.tuesdaymorning.datawarehouse.server;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class RPCsuperImpl extends RemoteServiceServlet {
 private static final long serialVersionUID = 200611201219L;

 protected String domain = "TM\\";

 public String getUserName() {
  String user = getThreadLocalRequest().getRemoteUser();

  if (user == null) {
   return "default";
  }

  if (!user.toLowerCase().startsWith(domain.toLowerCase())) {
   user = domain + user;
  }

  return user;
 }
}

 
HTH,
Chad

 
Reply all
Reply to author
Forward
0 new messages