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

大家好,我正在 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"

}


沧海一幻觉
浏览 538回答 3
3回答

米琪卡哇伊

解决方案:在这里我得到了解决方案。Jhipster 用户创建默认配置的问题。当我们使用 Jhipster 创建应用程序和实体时,它还会创建用户身份验证作为其功能。但在我的情况下,用户不是在我在创建过程中选择的数据库中创建的。负责表:-jhi_userjhi_user_authorityjhi_authority因此,我们只需要在这些表中提供 Jhipster 默认用户的详细信息。用户名:admin密码:admin确保密码是加密形式。

茅侃侃

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

SMILET

看起来您使用身份验证执行 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/
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java