HorizontalLayout userArea = new HorizontalLayout();
String id = env.getProperty("app.security.scheme", Scheme.BASIC.id());
if (id.equals(Scheme.FORM.id())) {
Button signOut = new Button("Sign Out");
signOut.addClickListener(logoutListener);
userArea.addComponent(signOut);
}
Label loggedInUser = new Label();
loggedInUser.setValue(username);
loggedInUser.setSizeUndefined();
userArea.addComponent(loggedInUser);