Keycloak / SpringBoot - OpenID 配置中提供的颁发者 与请求的颁发者 不匹配

2024-01-12

我对我刚刚加入的项目有疑问。

技术栈:

  • Jhipster 与 Angular 和 SpringBoot
  • Keycloak

我将正确的网址替换为 example.com 和 bar.com

应用程序.yaml https://i.stack.imgur.com/qHA9h.png

终点https://bar.com/auth/realms/artemis/.well-known/openid-configuration https://bar.com/auth/realms/artemis/.well-known/openid-configuration返回这个:

{
  "issuer": "https://example.com/auth/realms/artemis",
  "authorization_endpoint": "https://example.com/auth/realms/artemis/protocol/openid-connect/auth",
  "token_endpoint": "https://bar.com/auth/realms/artemis/protocol/openid-connect/token",
  "token_introspection_endpoint": "https://bar.com/auth/realms/artemis/protocol/openid-connect/token/introspect",
  "userinfo_endpoint": "https://bar.com/auth/realms/artemis/protocol/openid-connect/userinfo",
  "end_session_endpoint": "https://example.com/auth/realms/artemis/protocol/openid-connect/logout",
  "jwks_uri": "https://bar.com/auth/realms/artemis/protocol/openid-connect/certs",
  "check_session_iframe": "https://example.com/auth/realms/artemis/protocol/openid-connect/login-status-iframe.html",
}

当我运行该应用程序时,我收到此错误:

Caused by: java.lang.IllegalStateException: The Issuer "https://example.com/auth/realms/artemis" provided in the OpenID Configuration did not match the requested issuer "https://bar.com:8443/auth/realms/artemis"
    at org.springframework.security.oauth2.client.registration.ClientRegistrations.fromOidcIssuerLocation(ClientRegistrations.java:76)
    at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getBuilderFromIssuerIfPossible(OAuth2ClientPropertiesRegistrationAdapter.java:84)
    at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getClientRegistration(OAuth2ClientPropertiesRegistrationAdapter.java:60)
    at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.lambda$getClientRegistrations$0(OAuth2ClientPropertiesRegistrationAdapter.java:53)
    at java.util.HashMap.forEach(HashMap.java:1289)
    at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getClientRegistrations(OAuth2ClientPropertiesRegistrationAdapter.java:52)
    at org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientRegistrationRepositoryConfiguration.clientRegistrationRepository(OAuth2ClientRegistrationRepositoryConfiguration.java:55)
    at org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientRegistrationRepositoryConfiguration$$EnhancerBySpringCGLIB$$c9d328e3.CGLIB$clientRegistrationRepository$0(<generated>)
    at org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientRegistrationRepositoryConfiguration$$EnhancerBySpringCGLIB$$c9d328e3$$FastClassBySpringCGLIB$$1d0ccf00.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
    at org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientRegistrationRepositoryConfiguration$$EnhancerBySpringCGLIB$$c9d328e3.clientRegistrationRepository(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 92 common frames omitted

我是 Spring Boot 的新手。我真的不明白我必须做什么才能使用两个不同的网址。

感谢您的帮助!如果您需要,我可以为您提供更多信息。


Your application.yaml config issuer-uri不匹配issuer使用的 OIDC Keycloak 领域的数量。将其设置为https://example.com/auth/realms/artemis应该没问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Keycloak / SpringBoot - OpenID 配置中提供的颁发者 与请求的颁发者 不匹配 的相关文章

  • Spring boot 404错误自定义错误响应ReST

    我正在使用 Spring boot 来托管 REST API 即使浏览器正在访问 URL 以及自定义数据结构 我也希望始终发送 JSON 响应 而不是使用标准错误响应 我可以使用 ControllerAdvice 和 ExceptionHa
  • 在SPRING BOOT中配置多个数据库

    我正在尝试为我的 Spring Boot 应用程序连接 2 个不同的数据库 但出现此错误 应用程序无法启动 描述 com SyncFibertToolSpring SyncFibertTool MydbDB Config MydbDbCon
  • Spring-Security + Angular 2 + CORS。无法重定向 Facebook 登录

    我正在构建一个在前端使用 Angular 2 在后端使用 Spring Boot 的应用程序 我正在使用 Spring Security 和 Spring Social 来允许通过 Facebook 登录 我以为我已正确配置 CORS 但收
  • @SubscribeMapping 与 @MessageMapping

    当在 Spring Boot 中使用 websockets 时 我见过使用以下示例 Configuration EnableWebSocketMessageBroker public class WebSocketConfig extend
  • Spring Data Jpa OneToMany 同时保存子实体和父实体?

    这是我的父实体 注意 为了简洁起见 删除了 getter setter lombok 注释 Entity public class Board Id GeneratedValue strategy GenerationType IDENTI
  • 使用 Spring Security 时,SecurityContext 是否在请求之间共享?

    在使用 Spring Boot 编写的 Rest API 上使用基于无状态令牌的身份验证时 我看到一些奇怪的行为 客户端在每个请求中包含一个 JWT 令牌 并且我编写的扩展 GenericFilterBean 的自定义过滤器使用以下命令将基
  • 从 SCDF 执行任务时,数据库凭证作为部分作业参数公开

    我有自定义构建的 SCDF 它在 Openshift 中构建为 docker 映像 并在 server deployment yaml 中称为 docker 映像 我使用 Oracle 数据库来存储任务元数据 并且是此处的外部源 我传递了
  • Spring @ComponentScan 不适用于 @Repository

    我的存储库与配置类位于不同的包中 因此我使用 Repostiory 将其注释为以下内容 package test Repository public interface UserTest extends JpaRepository
  • 如何在 Spring Mvc 项目中设置上下文根

    我在 Tomcat 服务器中使用 Spring MVC 项目 每次运行应用程序时 服务器上下文根都会更改 如何设置固定上下文根 我的项目名称是 DemoApplication 首先部署此上下文根 路径是 http localhost 808
  • 使用 Nginx 时缺少 HTTP 状态代码名称

    我正在使用 Nginx 将所有 HTTP 请求重定向到 HTTPS 在我的 Spring Boot 应用程序中 这是我正在使用的 nginx 配置 通过它我可以将所有请求重定向到 Https 但是当我这样做时 我得到了状态码返回正确 但没有
  • Keycloak - 代理后面的 URL 重置密码电子邮件

    我们正在使用钥匙斗篷 2 0 0 Final安装在后面Nginx 代理在 RedHat 环境上 我们目前面临的问题是重设密码使用内部服务器主机而不是操作 URL 中的外部服务器发送电子邮件的功能 因为我们位于代理后面 我通过电子邮件收到此信
  • Spring Boot中服务接口类的用途

    我的问题是关于接口类的使用 我对 Spring 还很陌生 所以如果这过于简单 请耐心等待 首先 当您可以在 BoxService 中声明 find all 时 这里拥有 IBoxService 接口有什么意义 其次 在控制器中如何使用IBo
  • Jackson 的 ObjectMapper 和 SQL 中的 RowMapper

    我们正在使用对象映射器 当将 ObjectMapper 与 RowMapper 一起使用时 是否应该在每个 mapRow 内部 如下所示 声明它 还是在 mapRow 外部声明为类公共成员 我认为根据本文 它应该作为公共类成员在外部 我应该
  • Springboot:防止Resttemplate对%进行双重编码

    我们的代码使用Asyncresttemplate如下 String uri http api host com version test address 23 language en US format json getAysncRestT
  • 在spring data jpa中实现动态数据源

    我有 N 个服务器 N 个数据库和 N 个配置 看下面的场景 因此 对于每个请求 我都需要根据配置访问服务器和数据库 spring data jpa如何实现动态数据源 你可以试试抽象路由数据源 https docs spring io sp
  • 如何防止嵌入式netty服务器使用spring-boot-starter-webflux启动?

    我想使用 Springs 新的反应式在客户端和服务器应用程序之间建立通信webflux扩大 对于依赖管理我使用gradle 我在服务器和客户端上的 build gradle 文件基本上是 buildscript repositories m
  • Spring Boot 中的 Spring Security 配置

    我正在努力转换Spring 3项目到Spring 4 Spring 启动 我还不知道这样做是否正确 我转换Spring 安全 XML配置到一个基于Java的配置如下 Configuration EnableWebSecurity publi
  • KeyCloak 服务器的自省端点

    我正在尝试探索 KeyCloak 服务器的功能 并希望通过使用获取有关访问令牌的信息 openid connect token introspect端点 因此 我将向此端点发送下一个请求 curl v data token type hin
  • Spring Boot 3 网关显示 503 service_unavailable

    我得到了一个NotFoundException 503 SERVICE UNAVAILABLE网关服务器日志中出现异常 我在 Docker 容器中运行微服务 我有一个auth service处理身份验证和 Jwt 的微服务 我可以使用 Po
  • 异步不适用于控制器的抽象超类方法

    我有一个BaseRestControllerRest 控制器扩展的类 它有一个我想异步运行的方法 public abstract class BaseRestController Async someThreadPoolTaskExecut

随机推荐