【问题标题】:How to set up a database for authenticate and data management如何设置用于身份验证和数据管理的数据库
【发布时间】:2022-01-17 08:46:29
【问题描述】:

我刚刚完成了 vaadin fusion (@marcushellberg) 的深度课程。真的很好。

现在我正在尝试做同样的事情,但现在我有一个带有信息的 Postgres 数据库,但我不知道如何从数据库中加载网格中的信息

以及如何从数据库中对用户进行身份验证,而不是对凭据进行硬编码...任何人都可以提供帮助吗?

我刚刚为其中一个创建了我的个性化实体、端点、存储库和视图,但是视图不会从数据库中加载信息,而且我还有 application.properties 文件,其中包含数据库信息并经过测试

我有什么遗漏的吗?

提前致谢,如果您需要我项目的更多信息,请告诉我。

我注意到在我的浏览器中我得到了这个

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

【问题讨论】:

    标签: vaadin vaadin-grid vaadin-fusion


    【解决方案1】:

    Vaadin Fusion 使用 Spring Security,如果您想在其中存储凭据,可以遵循任何有关数据库身份验证的 Spring Security 教程。例如https://www.baeldung.com/spring-security-authentication-with-a-database

    对于端点访问,请确保您在端点上有一个@PermitAll 或其他适当的注释,因为当您启用安全性https://vaadin.com/docs/latest/fusion/security/configuring/#security-options 时,它们默认全部拒绝

    【讨论】:

    • 我没有启用安全性并且我有 PermitAll 注释,而且我正在比较 github repo 以确保我在 endpont 文件中没有任何遗漏。我不知道这是怎么回事。
    • @AnonimousAllowed 成功了,'@PermitAll 不要...非常感谢,我将继续实施。
    • 是的。 @PermitAll 表示允许任何登录用户。 @AnonymousAllowed 表示允许任何人
    • 那我错了,我虽然@PermitAll允许未登录用户,谢谢。
    猜你喜欢
    • 2010-09-13
    • 1970-01-01
    • 2017-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多