*/
public static UsernameTokenBinding createUntBinding(FilterProcessingContext context,UsernameTokenBinding untBinding, int firstByte) throws XWSSecurityException{
UsernameTokenBinding binding = (UsernameTokenBinding)untBinding.clone();
JAXBFilterProcessingContext opContext = (JAXBFilterProcessingContext) context;
SignaturePolicy authPolicy = (SignaturePolicy) context.getSecurityPolicy();
UsernameToken unToken = null;
if (context.getusernameTokenBinding() == null) {
unToken = new UsernameToken(opContext.getSOAPVersion());
} else {
if (untBinding.getUUID().equals(context.getusernameTokenBinding().getUUID())) {
unToken = context.getusernameTokenBinding().getUsernameToken();
} else {
unToken = new UsernameToken(opContext.getSOAPVersion());
}
}
try {
binding = UsernameTokenDataResolver.setSaltandIterationsforUsernameToken(opContext, unToken, authPolicy, binding, firstByte);
} catch (UnsupportedEncodingException ex) {
throw new XWSSecurityException("error occurred while decoding the salt in username token",ex);
} catch(XWSSecurityException ex){
throw ex;
}
if (binding.getUseNonce()&& unToken.getNonceValue() == null ) {
unToken.setNonce(binding.getNonce());
String creationTime = "";
TimestampPolicy tPolicy = (TimestampPolicy) binding.getFeatureBinding();
if(tPolicy == null)tPolicy = (TimestampPolicy) binding.newTimestampFeatureBinding();
creationTime = tPolicy.getCreationTime();
unToken.setCreationTime(creationTime);
}
if (binding.getUseCreated() && unToken.getCreatedValue() == null) {
String creationTime = "";
TimestampPolicy tPolicy = (TimestampPolicy) binding.getFeatureBinding();
if(tPolicy == null)tPolicy = (TimestampPolicy) binding.newTimestampFeatureBinding();
creationTime = tPolicy.getCreationTime();
unToken.setCreationTime(creationTime);
}
binding.setUsernameToken(unToken);
String dataEncAlgo = null;
if (context.getAlgorithmSuite() != null) {
dataEncAlgo = context.getAlgorithmSuite().getEncryptionAlgorithm();