在Spring Security SAML身份验证请求中配置POST ProtocolBinding

dev*_*kat 5 security binding spring saml spring-saml

Spring Security SAML坚持在SAML身份验证请求(ProtocolBinding属性)中请求Artifact绑定:

<saml2p:AuthnRequest xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol"
                 AssertionConsumerServiceURL="http://sp.com/saml/SSO/alias/defaultAlias"
                 Destination="https://idp.com/idp"
                 ForceAuthn="false"
                 ID="a4acj06d42fdc0d3494h859g3f7005c"
                 IsPassive="false"
                 IssueInstant="2012-12-05T17:07:18.271Z"
                 ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
                 Version="2.0"
                 >
Run Code Online (Sandbox Code Playgroud)

我该如何配置POST绑定?谢谢你的回答!

- 安德烈亚斯

Ben*_*den 7

感谢nobby和Sanjeev,我最近将此应用于类似的案例,它让我走上正轨.

作为Spring Security SAML2扩展的新手,我不得不进行一些额外的挖掘以应用WebSSOProfileOptions.基本上,要在SAML身份验证请求上获取HTTP-POST绑定,您需要传递给该org.springframework.security.saml.websso.WebSSOProfileImpl#sendAuthenticationRequest()方法的配置文件选项.

对于我们的配置,它与Spring RC2示例项目中配置非常相似,这意味着将WebSSOProfileOptionsSanjeev解决方案中描述的bean 传递给samlEntryPoint.defaultProfileOptions属性(或在那里添加绑定属性).

麻烦的是,这并没有导致AuthnRequest获取设置的绑定属性.在我们的例子中,我们的SAML元数据是isDefault=true在HTTP-Artifact绑定上指定的AssertionConsumerService.在我们的RC2版本的Spring Security SAML2库中,这是默认行为org.springframework.security.saml.metadata.MetadataGenerator.

可以通过设置assertionConsumerIndexMetadataGenerator 的属性来覆盖它.在我们的示例中,HTTP Post断言使用者在索引1处配置.

<bean id="metadataGeneratorFilter" class="org.springframework.security.saml.metadata.MetadataGeneratorFilter">
   <constructor-arg>
      <bean class="org.springframework.security.saml.metadata.MetadataGenerator">
         <property name="assertionConsumerIndex" value="1" /><!-- 1=HTTP-POST -->
      </bean>
   </constructor-arg>
</bean>
Run Code Online (Sandbox Code Playgroud)


San*_*ngi 2

securityContext.xmlsp启动时可以设置绑定。下面的示例使用 HTTP-POST

 <bean class="org.springframework.security.saml.websso.WebSSOProfileOptions">
                <property name="includeScoping" value="false"/>
                <property name="binding" value="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
            </bean>
Run Code Online (Sandbox Code Playgroud)

绑定的值可以在类中找到org.opensaml.common.xml.SAMLConstants