protected void validateProxyRestrictionCondition(Conditions conditions) throws ValidationException { int proxyRestrictionCount = 0; for (int i = 0; i < conditions.getConditions().size(); i++) { if (conditions.getConditions().get(i) instanceof ProxyRestriction) { proxyRestrictionCount++; } } if (proxyRestrictionCount > 1) { throw new ValidationException("At most one instance of ProxyRestriction allowed"); } } }
/** * Checks that there is at most one OneTimeUse condition. * * @param conditions * @throws ValidationException */ protected void validateOneTimeUseCondition(Conditions conditions) throws ValidationException { int oneTimeUseCount = 0; for (int i = 0; i < conditions.getConditions().size(); i++) { if (conditions.getConditions().get(i) instanceof OneTimeUse) { oneTimeUseCount++; } } if (oneTimeUseCount > 1) { throw new ValidationException("At most one instance of OneTimeUse allowed"); } }
/** {@inheritDoc} */ protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException { Conditions conditions = (Conditions) parentObject; if (childObject instanceof Condition) { conditions.getConditions().add((Condition) childObject); } else { super.processChildElement(parentObject, childObject); } }
@Override public Conditions build() { Conditions conditions = new ConditionsBuilder().buildObject(); conditions.setNotBefore(notBefore); conditions.setNotOnOrAfter(notOnOrAfter); for (Condition condition : conditionsList) { conditions.getConditions().add(condition); } return conditions; } }
for (Condition condition : conditions.getConditions()) {
conditions.getConditions().add(createOneTimeUse()); conditions.getConditions().add(createProxyRestriction(conditionsBean.getProxyRestriction()));
conditions.getConditions().add(createOneTimeUse()); conditions.getConditions().add(createProxyRestriction(conditionsBean.getProxyRestriction()));
conditions.getConditions().add( Saml2Util.buildXMLObject(OneTimeUse.class, OneTimeUse.DEFAULT_ELEMENT_NAME));