UsernameToken with password digest (HashPassword) and timestamp over SSL
This policy requires that you protect the message with HTTPS, and that a UsernameToken is used for authentication. The UsernameToken password is hashed with the created timestamp and nonce. There is also a message Timestamp.
The following policy shows a UsernameToken with password digest
(HashPassword) and timestamp over SSL:
<wsp:Policy wsu:Id="UserNameTokenPasswordHashOverSSL">
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding>
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken>
<wsp:Policy />
</sp:HttpsToken>
</wsp:Policy>
</sp:TransportToken>
<sp:Layout>
<wsp:Policy>
<sp:Lax />
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp />
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128 />
</wsp:Policy>
</sp:AlgorithmSuite>
</wsp:Policy>
</sp:TransportBinding>
<sp:SupportingTokens>
<wsp:Policy>
<sp:UsernameToken
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssUsernameToken10 />
<sp:HashPassword/>
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:SupportingTokens>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
The namespaces used in this example are:
- xmlns:wsp="http://www.w3.org/ns/ws-policy"
- xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
- xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
To validate the UsernameToken in the Liberty server, you must provide a password callback handler class on the provider side by setting the ws-security.callback-handler attribute. The password from the callback handler must match the password that is used in the PasswordDigest. The password must also match the password in the user registry in Liberty.