java—具有不同二级域的sp中的多AssertConsumerService

mspsb9vt  于 2021-07-23  发布在  Java
关注(0)|答案(0)|浏览(283)

我正在用springsecurity saml扩展实现一个多租户应用程序。
我有一个服务提供商(sp)为每个租户。所有sp都运行在同一服务器上,该服务器公开了特定于sp的第二级域:
sp1.myapp.com/myapi/1/
sp1.myapp.com/myapi/2/
在每个sp元数据文件中,我都配置了特定于租户的assertionconsumerservice。
当我测试sso登录时,当它得到身份提供者(idp)的响应时,我在sp端得到一个ko。在原木方面,我只看到:

ERROR [BaseSAMLMessageDecoder] SAML message intended destination endpoint 'https://sp1.myapp.com/myapi/saml/SSO' did not match the recipient endpoint 'https://default.myapp.com/myapi/saml/SSO'

他在哪里https://default.myapp.com/myapi/saml/sso'是设置为负载平衡器上下文提供程序的servername的url:

<bean id="lbContextProvider" class="org.springframework.security.saml.context.SAMLContextProviderLB" init-method="afterPropertiesSet">
    <property name="metadata"    ref="metadata" />
    <property name="keyManager"  ref="keyManager" />
    <property name="scheme"      value="https" />
    <property name="serverName"  value="default.myapp.com" />
    <property name="contextPath" value="/myapi" />
    <property name="serverPort"  value="443" />
    <property name="includeServerPortInRequestURL" value="true" />
</bean>

问题

在docs.spring.io/spring-security-saml中我看到了
服务提供者现在可以使用相同的绑定定义多个Assert使用者终结点
如何配置?
它是否与负载平衡器上下文提供程序冲突?
我是否可以提供具有不同二级域的多个assertionconsumerservice而不产生此冲突?

我已经测试过了:

这个问题似乎用lb解决了,但是有人知道我是否可以向负载平衡器上下文提供程序提供多个servername(可能使用动态选择)?
按照ch.13 docs.spring.io/spring-security-saml以及针对此问题的建议,禁用对inresponsetofield的检查。
按照此问题的建议配置successredirecthandler的defaulttargeturl(在这里我使用的是org.springframework.security.web.authentication.SimpleRutheNotificationSuccessHandler的自定义超类)。另外,这种溶液不是多租户的。

<bean id="successRedirectHandler" class="org.MySamlAuthenticationSuccessHandler" 
                            init-method="afterPropertiesSet">
    <property name="contextPath" value="/myapi" />
    <property name="defaultTargetUrl" value="https://default.myapp.com/myapi/saml/SSO"/>
    <property name="requireProxyWrapping" value="false"/>
</bean>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题