/** * Get the {@link ProxyRestriction} to which audiences will be added. * * @param conditions existing set of conditions * * @return the condition to which audiences will be added */ @Nonnull private ProxyRestriction getProxyRestriction(@Nonnull final Conditions conditions) { final ProxyRestriction condition; if (conditions.getProxyRestriction() == null) { final SAMLObjectBuilder<ProxyRestriction> conditionBuilder = (SAMLObjectBuilder<ProxyRestriction>) XMLObjectProviderRegistrySupport.getBuilderFactory().<ProxyRestriction>getBuilderOrThrow( ProxyRestriction.DEFAULT_ELEMENT_NAME); log.debug("{} Adding new ProxyRestriction", getLogPrefix()); condition = conditionBuilder.buildObject(); conditions.getConditions().add(condition); } else { log.debug("{} Conditions already contained an ProxyRestriction, using it", getLogPrefix()); condition = conditions.getProxyRestriction(); } return condition; }