Problems with manually authenticating a user, without the password. (Custom OTT)

Hey there,

im trying to build a custom Login where the user receives a link containing an one time token and then is logged in. since i dont know the users password when checking the token for validity im having issues logging the user in.

I already tried authenticating with the password set to null and setting the authorities manually, but even though it says the user is now authenticated the user is stuck on the login page and does not get redirected…

Any tips?

Hi and welcome at Vaadin Forum. Do you use Spring Security? How does your current code looks like?

Hey,
thanks for your response. I actually fixed it in the mean time.

I had to set the new Securitycontext after authenticating.

VaadinSession.getCurrent().getSession().setAttribute(“SPRING_SECURITY_CONTEXT”, SecurityContextHolder.getContext());

Thanks anyways.

Maybe my blog post could also be of interest Securing Vaadin Applications with One-Time Token – Martinelli