使用OPENAM的Spring Security SAML扩展

时间:2013-03-13 21:23:41

标签: spring security saml openam spring-saml

所以这是场景。

我有我的网络应用< ==> IDP代理< ==> IDP。 IDP代理和IDP都是openam实例。 我们可以添加额外的IDP(来自其他客户端),因此我们需要一个代理来屏蔽复杂性。

所以这里IDP Prxy是:http://idpproxydev.devs1.int:8080/openam

IDP网址为:http://idpdev.devs1.int:80/openam

我的网络应用是:http://ocr-jq0zt91.devs1.int:9081/LOS

我开始使用了 http://static.springsource.org/spring-security/site/extensions/saml/index.html用于集成,现在我看到SAML:我的网络应用程序发出了请求。

我现在遇到的问题是当我使用Fedlet(在IDP代理上使用Openam生成的客户端)测试我的设置时,请求转到代理然后被路由到IDP,因为Fedlet生成的SAML请求具有额外的信息,这是SAML请求中的此片段

<samlp:Scoping xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"  ProxyCount="1"   >
       <samlp:IDPList xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
        <samlp:IDPEntry xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
                        ProviderID="http://idpdev.devs1.int:80/openam"  />
    </samlp:IDPList>
</samlp:Scoping>

因此,我看到的唯一区别是FEDLET生成的SAML请求中的额外工资负担。

因此,通过在SAML请求中查看上面的代码段,IDP代理知道最终目的地本身不是http://idpproxydev.devs1.int:8080/openam),而是另一个实体,在这种情况下是http://idpdev.devs1.int:80/openam

Fedlet有扩展元数据的附加属性文件(sp-extended.xml),我们可以在其中添加这些附加内容。

<Attribute name="enableIDPProxy">
           <Value>true</Value>
       </Attribute>
       <Attribute name="idpProxyList">
           <Value> http://idpdev.devs1.int:80/openam</Value>  (the attribute name is little confusing as this is the IDP)
       </Attribute>
       <Attribute name="idpProxyCount">
           <Value>1</Value>
       </Attribute>

但是在Spring saml安全库中,我没有看到任何可以添加这些附加属性的方法,以便SAML请求可以包含此信息。 有没有办法可以提供上面列出的其他属性?

以便在我的网络应用发送请求时可以读取spring saml扩展名吗?

1 个答案:

答案 0 :(得分:2)

我找到了解决此问题的方法。 您需要使用org.springframework.security.saml.websso.WebSSOProfileOptions

以下是我的网络应用中的一个示例。将其添加到security.xml

<beans:bean id="samlEntryPoint" class="org.springframework.security.saml.SAMLEntryPoint">
        <beans:property name="defaultProfileOptions">
            <beans:bean class="org.springframework.security.saml.websso.WebSSOProfileOptions">
                <beans:property name="binding" value="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
                <beans:property name="includeScoping" value="true"/>
                <!-- to skip proxyCount, 0 to disable proxying, >0 to allow proxying-->
                <beans:property name="proxyCount" value="1"/>
                <beans:property name="allowedIDPs">
                    <beans:set>
     <beans:value>http://idpproxydev.devs1.int:80/openam</beans:value>                  
                    </beans:set>
               </beans:property>        
  <!--  Allowed Values are in  AuthnContextComparison.java -->
            <beans:property name="authnContextComparison" value="EXACT"/>
            <beans:property name="authnContexts">
                    <beans:list>
 <beans:value>
urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
</beans:value>                  
                    </beans:list>
            </beans:property>
            <beans:property name="nameID" value="urn:oasis:names:tc:SAML:2.0:nameid-  format:transient"/>
            <beans:property name="allowCreate" value="true"/>
                </beans:bean>
        </beans:property>
    </beans:bean>

现在我看到来自WEB应用程序的SAML请求具有IDP列表。

             

还添加了一些附加说明,以使用SPRING SAML扩展将JSF Web应用程序与openam集成。

请参阅我的文章,了解与Openam概念相关的一般信息 http://reddymails.blogspot.com/2013/03/sso-for-java-or-net-web-based.html

使用Spring SAML扩展和Spring Security将JSF 2 Web应用程序与Openam集成的步骤。 http://reddymails.blogspot.com/2013/06/integrating-jsf-web-applicataion-with.html

-rama

相关问题