为了账号安全,请及时绑定邮箱和手机立即绑定

Jhipster 网关需要完全身份验证才能访问此资源

Jhipster 网关需要完全身份验证才能访问此资源

沧海一幻觉 2021-09-15 14:40:25
大家好,我正在 ubuntu 操作系统上开发 Jhipster。我的项目设置成功完成。但是在尝试测试 apis 时,它给了我身份验证错误。这是测试 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"}
查看完整描述

3 回答

?
米琪卡哇伊

TA贡献1998条经验 获得超6个赞

解决方案:

在这里我得到了解决方案。

Jhipster 用户创建默认配置的问题。
当我们使用 Jhipster 创建应用程序和实体时,它还会创建用户身份验证作为其功能。
但在我的情况下,用户不是在我在创建过程中选择的数据库中创建的。

负责表:-

  1. jhi_user

  2. jhi_user_authority

  3. jhi_authority

因此,我们只需要在这些表中提供 Jhipster 默认用户的详细信息。

用户名:admin
密码:admin

确保密码是加密形式。


查看完整回答
反对 回复 2021-09-15
?
茅侃侃

TA贡献1842条经验 获得超21个赞

在我的情况下(在开发配置文件中),我更新了JWT 令牌,在所有应用程序(微服务、网关和注册表)中更改为 base64,另外,注释旧属性“秘密”并使用相同的密钥。然后从网关正确测试API,没有授权问题。



查看完整回答
反对 回复 2021-09-15
?
SMILET

TA贡献1796条经验 获得超4个赞

看起来您使用身份验证执行 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

您可以在 application.yml 文件的 central-config 包中找到您的秘密 JWT 密钥

有关更多详细信息,请阅读 JHipster 文档:https : //www.jhipster.tech/security/#-json-web-tokens-jwt https://www.jhipster.tech/jhipster-registry/


查看完整回答
反对 回复 2021-09-15
  • 3 回答
  • 0 关注
  • 537 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号