Vertx Form Login Handler with Postgresql Failure



我正在尝试使用SqlAuthentication的FormLoginHandler和Postgresql数据库验证用户。

但我得到以下错误:六月15,2022 1:14:34 PM io. vertex .ext.web. routingcontext严重:路由器中未处理的异常io.vertx.ext.web.handler.HttpException:未经授权的io.vert .core.impl. noacktracethrowable: Invalid username/password

我正在提供正确的凭证。

代码片段是:

SqlAuthenticationOptions sauthopts = new SqlAuthenticationOptions();

sauthopts.setAuthenticationQuery (AUTHENTICATE_QUERY);

SqlAuthentication authenticationProvider = SqlAuthentication.create(sqlClient, sauthopts);
router.route("/secure/*").handler(RedirectAuthHandler.create(authenticationProvider, "/login.html"));
FormLoginHandler formLoginHandler =  FormLoginHandler.create(authenticationProvider);
router.route("/loginhandler").handler(formLoginHandler);  

如果我在这里错过了什么,请让我知道;或者给我举个例子。

Thanks in Advance.

您的设置第一眼没有显示任何异常。出于安全考虑,我们不能"仅仅"记录身份验证数据,因为这将是一个严重的OWASP错误和安全漏洞。

我最好的猜测是,可能是一些不完全正确的查询,所以这意味着你现在有2个选项:

  1. 调试应用程序并查看正在发送的查询+参数
  2. 准备一个小的完整的例子,显示错误,并在vert中打开一个问题。

如果您是从旧版本升级,请注意在vert。X 4.2.0对base64编码进行了一些更改,以保持跨模块的一致性。这可能是身份验证失败的原因,因为编码的哈希值可能略有不同。如果您从一开始就使用4.3.0,那么这将不是问题。

最新更新