【发布时间】:2023-04-10 19:30:01
【问题描述】:
我有一个与 Azure AD SAML 登录集成的 Spring Boot 应用程序。我遵循this 示例来实现这一点。它在 localhost 中运行良好,但在部署到 prod url 时,它不断给出以下错误
我在授权请求 URL 中看到的重定向 uri 以 http 开头。这是矛盾的,因为 Azure 应用注册不允许配置任何非 https 的 URL,唯一的例外是 localhost。
为了匹配 URL,我尝试在 Azure 门户中编辑 App Registration 的清单以使其成为 http。现在,似乎 URL 匹配,但随后出现以下错误:
我还尝试使用堆栈溢出帖子here 中提到的“azure.activedirectory.redirect-uri-template”在 azure 门户和 application.properties 上设置 https URL,但这也不起作用。
我也浏览过this 的帖子,但这也没有帮助。
任何帮助将不胜感激。
【问题讨论】:
-
您好,请在issue 之后检查您的 Tomcat 服务器。另一种方法是在applications.properties中添加
server.forward-headers-strategy=native,避免以http开头。 -
@PamelaPeng,感谢您的回复。添加 server.forward-headers-strategy=native 没有帮助。我还在 application.properties 从您共享的链接中添加了其他行 azure.activedirectory.redirect-uri-template= xxx.xxx.xxx/login/oauth2/code/azuresecurity.oauth2.client.pre-established-redirecturi=xxx.xxx.xxx/login/oauth2/code/azuresecurity.oauth2.client.registered- redirecturi=xxx.xxx.xxx/login/oauth2/code/azuresecurity.oauth2.client.use-current-uri=false server.forward-headers-strategy=native
-
感谢@PamelaPeng,添加您分享的链接中的所有行解决了问题
标签: spring-boot azure-active-directory saml