Jhipster 网关访问此资源需要完全身份验证
Jhipster gateway Full authentication is required to access this resource
大家好,我正在 ubuntu os 上开发 Jhipster。
我的项目设置成功完成。
但是当尝试测试 api 时,它给了我身份验证错误。
这里是测试时发生的错误API。如果有人帮助我,我会很高兴。
错误:
rExceptionResolver : Resolved exception caused by Handler execution: org.springframework.security.authentication.InsufficientAuthenticationException: Full authentication is required to access this resource
网络浏览器
{
"type" : "https://www.jhipster.tech/problem/problem-with-message",
"title" : "Unauthorized",
"status" : 401,
"detail" : "Full authentication is required to access this resource",
"path" : "/api/account",
"message" : "error.http.401"
}
Jhipster 用户创建的默认配置问题。
当我们使用 Jhipster 创建应用程序和实体时,它还会创建用户身份验证作为它们的功能。
但在我的例子中,用户不是在我在创建时选择的数据库中创建的。
负责表:
- jhi_user
- jhi_user_authority
- jhi_authority
因此,我们只需要在这些表中提供 Jhipster 默认用户的详细信息。
用户名:admin
密码:admin
确保密码是加密形式。
在我的例子中 (在开发配置文件中),我更新了 JWT 令牌,在所有应用程序(微服务,网关和注册表),此外,注释旧的 属性 "secret" 并使用相同的密钥。然后从网关测试API正确,没有授权问题。
jh版本5.7.1
看起来您在执行 JHipster 注册表时使用了身份验证,而您的应用程序没有使用。
如果您没有更改 JHipster jwt 密钥,则必须使用下一个参数执行您的应用程序(微服务):
--spring.security.user.password=admin --jhipster.security.authentication.jwt.secret=my-secret-key-which-should-be-changed-in-production-and-be-base64-encoded --spring.cloud.config.server.composite.0.type=native --spring.cloud.config.server.composite.0.search-locations=file:./central-config
You secret JWT key you could find in central-config package in application.yml file
有关更多详细信息,请阅读 JHipster 文档:
https://www.jhipster.tech/security/#-json-web-tokens-jwt
https://www.jhipster.tech/jhipster-registry/
我在生成应用程序后尝试登录时遇到此错误。测试 运行 很好。
删除目标文件夹并重建整个项目似乎可以解决问题。
大家好,我正在 ubuntu os 上开发 Jhipster。 我的项目设置成功完成。 但是当尝试测试 api 时,它给了我身份验证错误。
这里是测试时发生的错误API。如果有人帮助我,我会很高兴。
错误:
rExceptionResolver : Resolved exception caused by Handler execution: org.springframework.security.authentication.InsufficientAuthenticationException: Full authentication is required to access this resource
网络浏览器
{
"type" : "https://www.jhipster.tech/problem/problem-with-message",
"title" : "Unauthorized",
"status" : 401,
"detail" : "Full authentication is required to access this resource",
"path" : "/api/account",
"message" : "error.http.401"
}
Jhipster 用户创建的默认配置问题。
当我们使用 Jhipster 创建应用程序和实体时,它还会创建用户身份验证作为它们的功能。
但在我的例子中,用户不是在我在创建时选择的数据库中创建的。
负责表:
- jhi_user
- jhi_user_authority
- jhi_authority
因此,我们只需要在这些表中提供 Jhipster 默认用户的详细信息。
用户名:admin
密码:admin
确保密码是加密形式。
在我的例子中 (在开发配置文件中),我更新了 JWT 令牌,在所有应用程序(微服务,网关和注册表),此外,注释旧的 属性 "secret" 并使用相同的密钥。然后从网关测试API正确,没有授权问题。
jh版本5.7.1
看起来您在执行 JHipster 注册表时使用了身份验证,而您的应用程序没有使用。 如果您没有更改 JHipster jwt 密钥,则必须使用下一个参数执行您的应用程序(微服务):
--spring.security.user.password=admin --jhipster.security.authentication.jwt.secret=my-secret-key-which-should-be-changed-in-production-and-be-base64-encoded --spring.cloud.config.server.composite.0.type=native --spring.cloud.config.server.composite.0.search-locations=file:./central-config
You secret JWT key you could find in central-config package in application.yml file
有关更多详细信息,请阅读 JHipster 文档: https://www.jhipster.tech/security/#-json-web-tokens-jwt https://www.jhipster.tech/jhipster-registry/
我在生成应用程序后尝试登录时遇到此错误。测试 运行 很好。
删除目标文件夹并重建整个项目似乎可以解决问题。