public class UsernameTokenBuilder implements AssertionBuilder {
public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException {
UsernameToken usernameToken = new UsernameToken();
OMAttribute attribute = element.getAttribute(Constants.INCLUDE_TOKEN);
String inclusionValue = attribute.getAttributeValue();
if (inclusionValue.endsWith(Constants.INCLUDE_NEVER)) {
usernameToken.setInclusion(Constants.INCLUDE_NEVER);
} else if (inclusionValue.endsWith(Constants.INCLUDE_ONCE)) {
usernameToken.setInclusion(Constants.INCLUDE_ONCE);
} else if (inclusionValue.endsWith(Constants.INCLUDE_ALWAYS_TO_RECIPIENT)) {
usernameToken.setInclusion(Constants.INCLUDE_ALWAYS_TO_RECIPIENT);
} else if (inclusionValue.endsWith(Constants.INCLUDE_ALWAYS)) {
usernameToken.setInclusion(Constants.INCLUDE_ALWAYS);
}
OMElement policyElement = element.getFirstElement();