vaadin / hilla

Build better business applications, faster. No more juggling REST endpoints or deciphering GraphQL queries. Hilla seamlessly connects Spring Boot and React to accelerate application development.
https://hilla.dev
Apache License 2.0
923 stars 57 forks source link

Authentication with Spring Security outdated #2880

Open Silicat-git opened 3 weeks ago

Silicat-git commented 3 weeks ago

The page for Authentication with SpringSecurity seems to be outdated, more specifically the Client-Side Security part https://vaadin.com/docs/latest/hilla/guides/security/spring-login

The AuthProvider needs to be added to the root component in an index.tsx, however the new @index.tsx doesmt seem to be the right place as its the main page ("/"). Also it suggest to add stuff to the routes.tsx file which also doesnt exist in the current starter.

I've added the AuthProvider to the @layout.tsx instead now since its the only logical place, which works for the most part, but inside the Layout file itself I am unable to use the auth login/logout methods aswell as aquiring the state directly unless I wrap those code snippets into their own components and inserting them into the layout instead. Trying to e.g. logout results in an error "Uncaught Error: AuthContext not initialized" otherwise

Not sure if this is how its supposed to work (assuming I didnt do it wrong) but it should be noted in the docs

platosha commented 3 weeks ago

Thanks for reaching out. Let us update the Authentication article.