简体   繁体   English

基于SAML版本的cxf DefaultSecurityTokenServiceProvider响应

[英]cxf DefaultSecurityTokenServiceProvider response based on SAML version

I am newly working with CXF STS and came across below requirements, which I am unable to proceed 我刚与CXF STS合作,遇到以下要求,因此无法继续进行

1 How can the DefaultSecurityTokenServiceProvider from CXF STS provide SAML assertion of different versions say 1.1 or 2.0 . 1 CXF STS的DefaultSecurityTokenServiceProvider如何提供不同的SAML断言,例如1.1或2.0。 I have an assumption on it.Please correct me if am wrong. 我对此有一个假设。如果有误,请纠正我。 The bean property for DefaultSecurityTokenServiceProvider:services DefaultSecurityTokenServiceProvider:services的bean属性

<property name="services" ref="myServiceList" />
<bean id="myServiceList" class="org.apache.cxf.sts.service.StaticService">
    <property name="endpoints" ref="wspAllowedEndpoints" />
</bean>
<util:list id="wspAllowedEndpoints">
    <value>http://localhost:8080/doubleit/services/doubleit.*</value>
</util:list>

It requests the wsdl for all allowed services, reads the policy element, 它为所有允许的服务请求wsdl,读取策略元素,

<sp:RequestSecurityTokenTemplate>
                          <t:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</t:TokenType>
                          <t:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/SymmetricKey</t:KeyType>
                          <t:KeySize>256</t:KeySize>
                       </sp:RequestSecurityTokenTemplate>

ans based on SAMLV1.1 or SAMLV2.0 it determines which version of SAML assertion to be sent in response 基于SAMLV1.1或SAMLV2.0的ans,它确定要发送哪个版本的SAML断言作为响应

2 How can I read the SAML assertion from org.apache.cxf.ws.security.trust.STSClient as text 2如何从org.apache.cxf.ws.security.trust.STSClient以文本形式读取SAML断言

**saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0" ID="s2b7afe8e21a0910d027dfbc94ec4b862e1fbbd9ab" IssueInstant="2007-12-10T11:39:48Z"**

so I can put them in header and work with SOAPUI as client? 所以我可以将它们放在标头中并以SOAPUI作为客户端使用?

The STS will issue a SAML 1.1 or 2.0 token by default depending on the TokenType that is sent. 默认情况下,STS会根据发送的TokenType发行SAML 1.1或2.0令牌。 Thus to support both 1.1 + 2.0, no action is needed in terms of the STS configuration. 因此,要同时支持1.1 + 2.0,就STS配置而言无需采取任何措施。

The STSClient will return a SecurityToken Object. STSClient将返回一个SecurityToken对象。 You can get the DOM representation of the returned token via stsClient.getToken(). 您可以通过stsClient.getToken()获取返回的令牌的DOM表示形式。 You can then use something like WSS4J's DOM2Writer.nodeToString(node) to convert to a String. 然后,您可以使用WSS4J的DOM2Writer.nodeToString(node)之类的东西转换为String。

Colm. 科尔姆

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM