public static void setProperty(String propertyName, String propertyValue) { try { getProperties().setProperty(propertyName, propertyValue); } catch (Exception ex) { } }
public static Properties getPipProperties() throws Exception { return getPipProperties(XACMLProperties.getPipProperties()); } }
/** * Used only when we want just xacml.rootPolicies and xacml.referencedPolicies without any ".url" entries. * * @return * @throws Exception */ public static Properties getPolicyProperties() throws Exception { return getPolicyProperties(XACMLProperties.getPolicyProperties(), false); }
public static Set<String> getPolicyIDs(Properties props) { Set<String> ids = XACMLProperties.getRootPolicyIDs(props); ids.addAll(XACMLProperties.getReferencedPolicyIDs(props)); return ids; }
public static String getProperty(String propertyName) { return getProperty(propertyName, null); }
int seconds; try { seconds = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_REGISTER_SLEEP)); } catch (NumberFormatException e) { logger.error("REGISTER_SLEEP: ", e); retries = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_REGISTER_RETRIES)); } catch (NumberFormatException e) { logger.error("REGISTER_SLEEP: ", e); URL url = new URL(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL)); logger.info("Registering with " + url.toString()); boolean finished = false; connection.setRequestProperty("Accept", "text/x-java-properties"); connection.setRequestProperty("Content-Type", "text/x-java-properties"); connection.setRequestProperty(XACMLRestProperties.PROP_PDP_HTTP_HEADER_ID, XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_ID)); connection.setUseCaches(false); String lists = XACMLProperties.PROP_ROOTPOLICIES + "=" + XACMLProperties.getProperty(XACMLProperties.PROP_ROOTPOLICIES); lists = lists + "\n" + XACMLProperties.PROP_REFERENCEDPOLICIES + "=" + XACMLProperties.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES) + "\n"; try (InputStream listsInputStream = new ByteArrayInputStream(lists.getBytes()); InputStream pipInputStream = Files.newInputStream(XACMLPdpLoader.getPIPConfig()); PutRequest req = new PutRequest(XACMLProperties.getPolicyProperties(properties, false), XACMLProperties.getPipProperties(properties)); XACMLPdpServlet.queue.offer(req);
Properties pdpPolicies = XACMLProperties.getPolicyProperties(pdpProperties, false); Properties pdpPipConfig = XACMLProperties.getPipProperties(pdpProperties); if (localRootPolicies.equals(pdpPolicies.getProperty(XACMLProperties.PROP_ROOTPOLICIES)) && localReferencedPolicies.equals(pdpPolicies.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES)) &&
XACMLProperties.reloadProperties(); XACMLProperties.getProperties().putAll(XACMLRest.restProperties); XACMLProperties.getProperties().putAll(policyProperties); XACMLProperties.getProperties().putAll(pipProperties); logger.debug(XACMLProperties.getProperties().toString()); } catch (IOException e) { logger.error("Cannot dump properties", e);
public static Properties getProperties() throws IOException { if (needCache) { synchronized(properties) { if (needCache) { File fileProperties = getPropertiesFile(); if (fileProperties.exists() && fileProperties.canRead()) { if (logger.isDebugEnabled()) { logger.debug("Loading properties from " + fileProperties.getAbsolutePath()); } try (InputStream is = new FileInputStream(fileProperties)) { properties.load(is); } } else { logger.warn("Properties file " + fileProperties.getAbsolutePath() + " cannot be read."); } needCache = false; } } } return properties; }
public static String getProperty(String propertyName) { return getProperty(propertyName, null); }
newProperties = XACMLProperties.getPolicyProperties(newProperties, true); if (newProperties.size() == 0) { logger.error("No policy properties in PUT"); newProperties = XACMLProperties.getPipProperties(newProperties); if (newProperties.size() == 0) { logger.error("No pips properties in PUT"); Properties newPolicyProperties = XACMLProperties.getPolicyProperties(newProperties, true); if (newPolicyProperties.size() == 0) { logger.error("No policy properties in PUT"); return; Properties newPipProperties = XACMLProperties.getPipProperties(newProperties); if (newPipProperties.size() == 0) { logger.error("No pips properties in PUT");
public static Set<String> getPolicyIDs(Properties props) { Set<String> ids = XACMLProperties.getRootPolicyIDs(props); ids.addAll(XACMLProperties.getReferencedPolicyIDs(props)); return ids; }
public static Properties getProperties() throws IOException { if (needCache) { synchronized(properties) { if (needCache) { File fileProperties = getPropertiesFile(); if (fileProperties.exists() && fileProperties.canRead()) { if (logger.isDebugEnabled()) { logger.debug("Loading properties from " + fileProperties.getAbsolutePath()); } try (InputStream is = new FileInputStream(fileProperties)) { properties.load(is); } } else { logger.warn("Properties file " + fileProperties.getAbsolutePath() + " cannot be read."); } needCache = false; } } } return properties; }
public static void setProperty(String propertyName, String propertyValue) { try { getProperties().setProperty(propertyName, propertyValue); } catch (Exception ex) { } }
public Heartbeat(PAPEngine engine) { this.papEngine = engine; this.heartbeatInterval = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_HEARTBEAT_INTERVAL, "10000")); this.heartbeatTimeout = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_HEARTBEAT_TIMEOUT, "10000")); }
public static synchronized void validatePolicies(Properties properties, StdPDPStatus status) throws PAPException { Set<String> rootPolicies = XACMLProperties.getRootPolicyIDs(properties); Set<String> refPolicies = XACMLProperties.getReferencedPolicyIDs(properties); for (String id : rootPolicies) { loadPolicy(properties, status, id, true); } // remember which policies were root policies status.addAllLoadedRootPolicies(status.getLoadedPolicies()); for (String id : refPolicies) { loadPolicy(properties, status, id, false); } logger.info("Loaded " + status.getLoadedPolicies().size() + " policies, failed to load " + status.getFailedPolicies().size() + " policies, " + status.getLoadedRootPolicies().size() + " root policies"); if (status.getLoadedRootPolicies().size() == 0) { logger.warn("NO ROOT POLICIES LOADED!!! Cannot serve PEP Requests."); status.addLoadWarning("NO ROOT POLICIES LOADED!!! Cannot serve PEP Requests."); } }
/** * Used only when we want just xacml.rootPolicies and xacml.referencedPolicies without any ".url" entries. * * @return * @throws Exception */ public static Properties getPolicyProperties() throws Exception { return getPolicyProperties(XACMLProperties.getPolicyProperties(), false); }
public static Properties getPipProperties() throws Exception { return getPipProperties(XACMLProperties.getPipProperties()); } }
protected static String getSourceProperty(String propertyName) { String result = System.getProperty(propertyName); if (result == null) { try { result = XACMLProperties.getProperties().getProperty(propertyName); } catch (Exception ex) { } } return result; }
public StdEngine() throws PAPException, IOException { // // Get the location in the file system of our repository // this.repository = Paths.get(XACMLProperties.getProperty(PROP_PAP_REPO)); // // Initialize // this.intialize(); }