public static String getProperty(String propertyName) { return getProperty(propertyName, null); }
public static String getProperty(String propertyName) { return getProperty(propertyName, null); }
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 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(); }
protected static Decision getConfiguredDefaultBehavior() { String defaultDecisionString = XACMLProperties.getProperty(XACMLProperties.PROP_PDP_BEHAVIOR); if (defaultDecisionString != null && defaultDecisionString.length() > 0) { return Decision.get(defaultDecisionString); } else { return null; } }
protected static Decision getConfiguredDefaultBehavior() { String defaultDecisionString = XACMLProperties.getProperty(XACMLProperties.PROP_PDP_BEHAVIOR); if (defaultDecisionString != null && defaultDecisionString.length() > 0) { return Decision.get(defaultDecisionString); } else { return null; } }
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(); }
public static synchronized Path getPDPConfig() throws PAPException { Path config = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_CONFIG)); if (Files.notExists(config)) { logger.warn(config.toAbsolutePath().toString() + " does NOT exist."); // // Try to create the directory // try { Files.createDirectories(config); } catch (IOException e) { logger.error("Failed to create config directory: " + config.toAbsolutePath().toString(), e); throw new PAPException("Failed to create config directory: " + config.toAbsolutePath().toString()); } } return config; }
/** * Finds the identifiers for all of the policies referenced by the given property name in the * <code>XACMLProperties</code> and loads them using the requested loading method. * * @param propertyName the <code>String</code> name of the property containing the list of policy identifiers * @return a <code>List</code> of <code>PolicyDef</code>s loaded from the given property name */ protected List<PolicyDef> getPolicyDefs(String propertyName) { String policyIds = XACMLProperties.getProperty(propertyName); if (policyIds == null || policyIds.length() == 0) { return null; } Iterable<String> policyIdArray = Splitter.on(',').trimResults().omitEmptyStrings().split(policyIds); if (policyIdArray == null) { return null; } List<PolicyDef> listPolicyDefs = new ArrayList<PolicyDef>(); for (String policyId : policyIdArray) { PolicyDef policyDef = this.loadPolicyDef(policyId); if (policyDef != null) { listPolicyDefs.add(policyDef); } } return listPolicyDefs; }
response.setContentType("text/x-java-properties"); try { String lists = XACMLProperties.PROP_ROOTPOLICIES + "=" + XACMLProperties.getProperty(XACMLProperties.PROP_ROOTPOLICIES, ""); lists = lists + "\n" + XACMLProperties.PROP_REFERENCEDPOLICIES + "=" + XACMLProperties.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES, "") + "\n"; try (InputStream listInputStream = new ByteArrayInputStream(lists.getBytes()); InputStream pipInputStream = Files.newInputStream(XACMLPdpLoader.getPIPConfig());
if (Boolean.parseBoolean(XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_REGISTER))) { this.registerRunnable = new XACMLPdpRegisterThread(); this.registerThread = new Thread(this.registerRunnable);
PAPEngineFactory factory = PAPEngineFactory.newInstance(XACMLProperties.getProperty(XACMLProperties.PROP_PAP_PAPENGINEFACTORY)); XACMLPapServlet.papURL = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL); if (Boolean.parseBoolean(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_INITIATE_PDP_CONFIG))) { this.initiateThread = new Thread(this); this.initiateThread.start();
if (request.getContentLength() > Integer.parseInt(XACMLProperties.getProperty("MAX_CONTENT_LENGTH", "32767"))) { String message = "Content-Length larger than server will accept."; logger.info(message);
urlConnection.setRequestProperty(XACMLRestProperties.PROP_PDP_HTTP_HEADER_ID, XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_ID));
String factoryClassName = null; if (xacmlProperties == null) { factoryClassName = XACMLProperties.getProperty(factoryId); } else { factoryClassName = xacmlProperties.getProperty(factoryId);
String propLocation = null; if (this.properties == null) { propLocation = XACMLProperties.getProperty(policyId + PROP_FILE); } else { propLocation = this.properties.getProperty(policyId + PROP_FILE); propLocation = XACMLProperties.getProperty(policyId + PROP_URL); } else { propLocation = this.properties.getProperty(policyId + PROP_URL);
String factoryClassName = null; if (xacmlProperties == null) { factoryClassName = XACMLProperties.getProperty(factoryId); } else { factoryClassName = xacmlProperties.getProperty(factoryId);
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());
URL url = locationURI.toURL(); URLConnection urlConnection = url.openConnection(); urlConnection.setRequestProperty(XACMLRestProperties.PROP_PDP_HTTP_HEADER_ID, XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_ID));
if (request.getContentLength() > Integer.parseInt(XACMLProperties.getProperty("MAX_CONTENT_LENGTH", "32767"))) { String message = "Content-Length larger than server will accept."; logger.info(message);