Java Web 服务: WS-Trust 和 WS-SecureConversation
2010-07-16 00:00:00 来源:WEB开发网清单 1 的请求主体显示了用于对 STS 的大多数请求的这个基本的 <wst:RequestSecurityToken> 元素。所需要的 <wst:RequestType> 子元素标识了此请求的特定类型,在本例中,为 Issue 请求。其余的子元素是 Issue 请求的一些可选参数,用来标识:
使用所请求的这个令牌能够访问的服务端点(<wsp:AppliesTo> 元素)
此令牌有效的时间区间(<wst:Lifetime> 元素)
令牌的类型(<wst:TokenType> 元素)
所请求的密匙的大小,单位为比特(<wst:KeySize> 元素)
由客户机提供的用来生成私密密匙的熵数据(<wst:Entropy> 元素)
用来生成私密密匙的算法(<wst:ComputedKeyAlgorithm> 元素)
如果收到此请求的 STS 批准了全部所需的由客户机提供的凭证并同意了此请求的条款,那么它就会在对 Issue 请求的响应中返回一个安全令牌。清单 2 显示了成功响应 Issue 请求的一个例子,其中也删除了头部:
清单 2. 以来自 STS 的安全令牌进行响应
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
...
</soap:Header>
<soap:Body xmlns:wsu=".../oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="Id-4824957">
<wst:RequestSecurityTokenResponseCollection
xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
<wst:RequestSecurityTokenResponse>
<wst:RequestedSecurityToken>
<wsc:SecurityContextToken
xmlns:wsc="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512"
xmlns:wsu=".../oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="sctId-A167EB2B526E0894DA12736604029099">
<wsc:Identifier>A167EB2B526E0894DA12736604029098</wsc:Identifier>
</wsc:SecurityContextToken>
</wst:RequestedSecurityToken>
<wst:RequestedAttachedReference>
<wsse:SecurityTokenReference
xmlns:wsse=".../oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:Reference xmlns:wsse=".../oasis-200401-wss-wssecurity-secext-1.0.xsd"
URI="#sctId-A167EB2B526E0894DA12736604029099"
ValueType=".../ws-sx/ws-secureconversation/200512/sct"/>
</wsse:SecurityTokenReference>
</wst:RequestedAttachedReference>
<wst:RequestedUnattachedReference>
<wsse:SecurityTokenReference
xmlns:wsse=".../oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:Reference xmlns:wsse=".../oasis-200401-wss-wssecurity-secext-1.0.xsd"
URI="A167EB2B526E0894DA12736604029098"
ValueType=".../ws-sx/ws-secureconversation/200512/sct"/>
</wsse:SecurityTokenReference>
</wst:RequestedUnattachedReference>
<wst:Lifetime xmlns:wsu=".../oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Created>2010-05-12T10:33:22.909Z</wsu:Created>
<wsu:Expires>2010-05-12T10:38:22.909Z</wsu:Expires>
</wst:Lifetime>
<wst:RequestedProofToken>
<wst:ComputedKey
>http://docs.oasis-open.org/ws-sx/ws-trust/200512/CK/PSHA1</wst:ComputedKey>
</wst:RequestedProofToken>
<wst:Entropy>
<wst:BinarySecret Type="http://docs.oasis-open.org/ws-sx/ws-trust/200512/Nonce"
>DpkK6qcELTO8dlPdDHMi2A==</wst:BinarySecret>
</wst:Entropy>
</wst:RequestSecurityTokenResponse>
</wst:RequestSecurityTokenResponseCollection>
</soap:Body>
</soap:Envelope>
更多精彩
赞助商链接