Search code examples
vaadin-gridhillavaadin-fusion

How to set up a database for authenticate and data management


I just finished the in deph course of vaadin fusion (@marcushellberg). It was really good.

Now Im trying to do the same but now I have a Postgres database with info, but I don't know how to load the information in the grid from the database

And how to authenticate an user from database instead of hardcode the credentials... Anyone can help?

I just created my personalized entities, endpoints, repositories and the view for one of them however the view do not load the info from database, also I have the application.properties file with database info and tested

Is there something that I am missing?

Thanks in advance and if you need more info from my project just let me know.

I notice that in my browser I am getting this

Error: Endpoint 'SupermercadosEndpoint' method 'getSupermercadosData' request cannot be accessed, reason: 'Access denied'

Solution

  • Vaadin Fusion uses Spring Security, you can follow any Spring Security tutorials on database authentication if you want to store your credentials there. Here's one for example https://www.baeldung.com/spring-security-authentication-with-a-database

    For the endpoint access, ensure you have a @PermitAll or another appropriate annotation on the Endpoint as they are deny all by default when you have security enabled https://vaadin.com/docs/latest/fusion/security/configuring/#security-options