Hi,
I’m using Spring Security with my Vaadin application. For the authentication process I use
Authentication request = new UsernamePasswordAuthenticationToken(name, password);
Authentication result = userAuthenticationManager.authenticate(request);
SecurityContextHolder.getContext().setAuthentication(result);
but when calling
SecurityContextHolder.getContext().getAuthentication().getPrincipal();
I get a Nullpointer-Exception most times. So I know I have to store the SecurityContext between the requests which can be done by using the SecurityContextPersistenceFilter. But unfortunatley I have not found any examples on how to do that.
I would be glad if someone could give me a hint on how to accomplish that. (My setup does not use a web.xml or security.xml)
Kind regards
Christoph