You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过YAML配置Spring Boot SAML服务提供商的entityID?

自定义Spring Security SAML2服务提供商(SP)的entityID

你之前的配置方向有误——你修改的是**身份提供商(IDP)的entity-id,但要自定义服务提供商(SP)**的entityID,需要在registration节点下新增service-provider分支来配置:

spring:
  security:
    saml2:
      relyingparty:
        registration:
          myapp:
            signing:
              credentials:
                - private-key-location: "classpath:private.pem"
                  certificate-location: "classpath:public.pem"
            # 新增SP配置节点,指定自定义entityID
            service-provider:
              entity-id: "http://localhost:8080/saml2/service-provider-metadata/myapp"
            identityprovider:
              entity-id: "你的IDP实体ID"
              singlesignon:
                sign-request: false
                url: https://.../auth/realms/saml-demo/protocol/saml

关键说明:

  • 默认情况下,SP的entityID会按{baseUrl}/saml2/service-provider-metadata/{registrationId}自动生成,通过显式配置service-provider.entity-id可以覆盖这个默认值。
  • 你之前尝试的okta节点是Spring Security针对Okta厂商提供的快捷配置入口,和SP的entityID设置无关,所以不会生效。

内容的提问来源于stack exchange,提问作者Alex97

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 15:53:14