kerberos & vaadin

Hi there!

I’m trying to get username inside my Vaadin application. We use kerberos to authenticate users on Tomcat or Weblogic application servers. Authentication is made by app server. So, if i use servlet API then i just use this code to get all info about user:

// request is the HTTPRequest instance
// Get the user’s windows user ID
String userID = request.getUserPrincipal().getName();

// Get the authentication information
AuthInfo info = Sso.getAuthInfo(request);

// Get the user’s realm
String realm = info.getAuthenticatiedUser().getRealm();

// Get the user’s Active Directory group information
String groups = info.getAuthenticatiedUser().getGroups();

But in Vaadin where i can get HttpRequest info?


in your Application class.

One way to communicate this information to other parts of the application would be to use Application.setUser(Object) to set your own user object with all the necessary information.

So, is it correct?

public class MyApp extends com.vaadin.Application implements HttpServletRequestListener

   String userName = null;
 final Window mainWindow = new Window("My App");

public void init()
           mainWindow.addComponent(new Label("Hello" + userName));

public void onRequestStart(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
userName = httpServletRequest.getRemoteUser();


public void onRequestEnd(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
	//To change body of implemented methods use File | Settings | File Templates.


Yeah, it works! Thanx.
I just set up basic auth on Tomcat and check this code. It works!

But in kerberos auth i will use this method userName = httpServletRequest.getUserPrincipal().getName();