After authentication(BASIC, DIGEST, FORM, CLIENT-CERT) in application i try get principal name calling
request.getUserPrincipal().getName() . Very many times getUserPrincipal() return
null . However if i call
VaadinServletService.getCurrentServletRequest().getUserPrincipal().getName() i always receive correct loggin name.
Very strange behavior VaadinRequest.getUserPrincipal method.
I also use Form based authentication in most of my applications , this way the request has a principal configured by the time it gets to the Servlet (and your application).
If you are doing Form based (or basic) authentication make sure your security-constraint(s) maches all the url patterns where you are using request.getUserPrincipal() , Im not sure if a Login Module has to configure a Principal for requests that dont require an auth-constraint.