spring-security - 如何从 Spring Security 5 中检索 SAML SP 元数据
问题描述
我正在使用Spring Security Core 5 中的 SAML 功能集(不是Spring Security SAML extension,它已过时)。到目前为止,我可以毫无问题地调出示例并登录到IdP ,即使它在我的本地主机中。但是,我想提取我的 SP 元数据以提供给我的 IdP。当我访问 SP 元数据 URL ( http://localhost:8080/saml2/service-provider-metadata/simplesamlphp
) 时,示例将我重定向到 IdP 登录页面。似乎所有路径都受到保护。我使用 WebSecurityConfigurerAdapter 进行了自定义,但是当我访问 SP 元数据 URL 时,它返回 404。
什么是正确的 SP 元数据 URL?如何找回它?
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/saml2/service-provider-metadata/**")
.permitAll()
.anyRequest().authenticated()
.and()
.saml2Login();
}
}
2020 年 6 月 26 日更新
Spring Security Github中的代码搜索结果SPSSODescriptor
为空,但Spring Security SAML 扩展 Github中没有。是否有设置没有元数据的 SAML SP 的新方法?
解决方案
这是因为 Spring Security 团队还没有在 Spring Security v5.3 及以下版本中实现 SAML 2.0 SP Metadata Endpoint。有关详细信息,请参见此处和此处。
更新: 它已在2020 年 8 月 6 日之后实施
推荐阅读
- c# - Unity项目在Android设备中找不到正确的数据库路径
- postgresql - Swift Vapor 3 + PostgreSQL + Docker-Compose 配置正确吗?
- sql - 是否有一行(或两行)简单的代码可以在另一个表中的最小日期之前提取记录?
- python - 在 python 中更改 protobuf 对象的元素最优雅的方法是什么?
- python-3.x - 如何修复“TypeError:仅对 DatetimeIndex、TimedeltaIndex 或 PeriodIndex 有效,但获得了 'Index' 的实例”?
- python - 保存具有体素尺寸的 nibabel 图像
- matplotlib - 如何在不每次都添加新颜色条的情况下更新图像
- sql-server - SQL Server:如何从 sys.master_files 获得正确的数据库大小?
- java - 为什么我不能滚动到 ListView 的末尾?
- error-handling - 尝试获取输出消息时 ADF eroor