Java Code Examples for org.wso2.balana.finder.PolicyFinder#setModules()
The following examples show how to use
org.wso2.balana.finder.PolicyFinder#setModules() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BalanaPDP.java From mobi with GNU Affero General Public License v3.0 | 6 votes |
private org.wso2.balana.PDP getPDP(IRI policyAlgorithm) { PDPConfig config = balana.getPdpConfig(); PolicyFinder policyFinder = new PolicyFinder(); Set<PolicyFinderModule> policyFinderModules = new HashSet<>(); policyFinderModules.add(balanaPRP); policyFinder.setModules(policyFinderModules); AttributeFinder attributeFinder = new AttributeFinder(); List<AttributeFinderModule> attributeFinderModules = new ArrayList<>(config.getAttributeFinder().getModules()); pips.forEach(pip -> { MobiAttributeFinder mobiAttributeFinder = new MobiAttributeFinder(vf, pip, jaxbContext); attributeFinderModules.add(mobiAttributeFinder); }); attributeFinder.setModules(attributeFinderModules); PDPConfig newConfig = new PDPConfig(attributeFinder, policyFinder, null, false); balanaPRP.setPDPConfig(newConfig); balanaPRP.setCombiningAlg(getAlgorithm(policyAlgorithm)); return new org.wso2.balana.PDP(newConfig); }
Example 2
Source File: EntitlementEngine.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
private void setUPPolicyFinder() { carbonPolicyFinder = new PolicyFinder(); Set<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>(); CarbonPolicyFinder tmpCarbonPolicyFinder = new CarbonPolicyFinder(); policyModules.add(tmpCarbonPolicyFinder); carbonPolicyFinder.setModules(policyModules); carbonPolicyFinder.init(); }
Example 3
Source File: EntitlementEngine.java From carbon-identity with Apache License 2.0 | 5 votes |
private void setUPPolicyFinder() { carbonPolicyFinder = new PolicyFinder(); Set<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>(); CarbonPolicyFinder tmpCarbonPolicyFinder = new CarbonPolicyFinder(); policyModules.add(tmpCarbonPolicyFinder); carbonPolicyFinder.setModules(policyModules); carbonPolicyFinder.init(); }
Example 4
Source File: ConfigurationStore.java From balana with Apache License 2.0 | 5 votes |
/** * Private helper that handles the pdp elements. */ private PDPConfig parsePDPConfig(Node root) throws ParsingException { ArrayList attrModules = new ArrayList(); HashSet policyModules = new HashSet(); ArrayList rsrcModules = new ArrayList(); // go through all elements of the pdp, loading the specified modules NodeList children = root.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); String name = DOMHelper.getLocalName(child); if (name.equals("policyFinderModule")) { policyModules.add(loadClass("module", child)); } else if (name.equals("attributeFinderModule")) { attrModules.add(loadClass("module", child)); } else if (name.equals("resourceFinderModule")) { rsrcModules.add(loadClass("module", child)); } } // after loading the modules, use the collections to setup a // PDPConfig based on this pdp element AttributeFinder attrFinder = new AttributeFinder(); attrFinder.setModules(attrModules); PolicyFinder policyFinder = new PolicyFinder(); policyFinder.setModules(policyModules); ResourceFinder rsrcFinder = new ResourceFinder(); rsrcFinder.setModules(rsrcModules); return new PDPConfig(attrFinder, policyFinder, rsrcFinder); }
Example 5
Source File: AdvanceTestV3.java From balana with Apache License 2.0 | 5 votes |
/** * Returns a new PDP instance with new XACML policies * * @param policies Set of XACML policy file names * @return a PDP instance */ private static PDP getPDPNewInstance(Set<String> policies){ PolicyFinder finder= new PolicyFinder(); Set<String> policyLocations = new HashSet<String>(); for(String policy : policies){ try { String policyPath = (new File(".")).getCanonicalPath() + File.separator + TestConstants.RESOURCE_PATH + File.separator + ROOT_DIRECTORY + File.separator + VERSION_DIRECTORY + File.separator + TestConstants.POLICY_DIRECTORY + File.separator + policy; policyLocations.add(policyPath); } catch (IOException e) { //ignore. } } FileBasedPolicyFinderModule testPolicyFinderModule = new FileBasedPolicyFinderModule(policyLocations); Set<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>(); policyModules.add(testPolicyFinderModule); finder.setModules(policyModules); Balana balana = Balana.getInstance(); PDPConfig pdpConfig = balana.getPdpConfig(); pdpConfig = new PDPConfig(pdpConfig.getAttributeFinder(), finder, pdpConfig.getResourceFinder(), true); return new PDP(pdpConfig); }
Example 6
Source File: ConformanceTestV2.java From balana with Apache License 2.0 | 5 votes |
/** * Returns a new PDP instance with new XACML policies * * @param policies Set of XACML policy file names * @return a PDP instance */ private static PDP getPDPNewInstance(Set<String> policies){ PolicyFinder finder= new PolicyFinder(); Set<String> policyLocations = new HashSet<String>(); for(String policy : policies){ try { String policyPath = (new File(".")).getCanonicalPath() + File.separator + TestConstants.RESOURCE_PATH + File.separator + ROOT_DIRECTORY + File.separator + VERSION_DIRECTORY + File.separator + TestConstants.POLICY_DIRECTORY + File.separator + policy; policyLocations.add(policyPath); } catch (IOException e) { //ignore. } } FileBasedPolicyFinderModule testPolicyFinderModule = new FileBasedPolicyFinderModule(policyLocations); Set<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>(); policyModules.add(testPolicyFinderModule); finder.setModules(policyModules); Balana balana = Balana.getInstance(); PDPConfig pdpConfig = balana.getPdpConfig(); pdpConfig = new PDPConfig(pdpConfig.getAttributeFinder(), finder, pdpConfig.getResourceFinder(), false); return new PDP(pdpConfig); }
Example 7
Source File: ConformanceTestV3.java From balana with Apache License 2.0 | 5 votes |
/** * Returns a new PDP instance with new XACML policies * * @param policies Set of XACML policy file names * @return a PDP instance */ private static PDP getPDPNewInstance(Set<String> policies){ PolicyFinder finder= new PolicyFinder(); Set<String> policyLocations = new HashSet<String>(); for(String policy : policies){ try { String policyPath = (new File(".")).getCanonicalPath() + File.separator + TestConstants.RESOURCE_PATH + File.separator + ROOT_DIRECTORY + File.separator + VERSION_DIRECTORY + File.separator + TestConstants.POLICY_DIRECTORY + File.separator + policy; policyLocations.add(policyPath); } catch (IOException e) { //ignore. } } FileBasedPolicyFinderModule testPolicyFinderModule = new FileBasedPolicyFinderModule(policyLocations); Set<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>(); policyModules.add(testPolicyFinderModule); finder.setModules(policyModules); Balana balana = Balana.getInstance(); PDPConfig pdpConfig = balana.getPdpConfig(); pdpConfig = new PDPConfig(pdpConfig.getAttributeFinder(), finder, pdpConfig.getResourceFinder(), false); return new PDP(pdpConfig); }
Example 8
Source File: BasicTestV3.java From balana with Apache License 2.0 | 5 votes |
/** * Returns a new PDP instance with new XACML policies * * @param policies Set of XACML policy file names * @return a PDP instance */ private static PDP getPDPNewInstance(Set<String> policies){ PolicyFinder finder= new PolicyFinder(); Set<String> policyLocations = new HashSet<String>(); for(String policy : policies){ try { String policyPath = (new File(".")).getCanonicalPath() + File.separator + TestConstants.RESOURCE_PATH + File.separator + ROOT_DIRECTORY + File.separator + VERSION_DIRECTORY + File.separator + TestConstants.POLICY_DIRECTORY + File.separator + policy; policyLocations.add(policyPath); } catch (IOException e) { //ignore. } } FileBasedPolicyFinderModule testPolicyFinderModule = new FileBasedPolicyFinderModule(policyLocations); Set<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>(); policyModules.add(testPolicyFinderModule); finder.setModules(policyModules); Balana balana = Balana.getInstance(); PDPConfig pdpConfig = balana.getPdpConfig(); pdpConfig = new PDPConfig(pdpConfig.getAttributeFinder(), finder, pdpConfig.getResourceFinder(), true); return new PDP(pdpConfig); }
Example 9
Source File: TestMultipleRequestV3.java From balana with Apache License 2.0 | 5 votes |
/** * Returns a new PDP instance with new XACML policies * * @param policies Set of XACML policy file names * @return a PDP instance */ private static PDP getPDPNewInstance(Set<String> policies) { PolicyFinder finder = new PolicyFinder(); Set<String> policyLocations = new HashSet<String>(); for (String policy : policies) { try { String policyPath = (new File(".")).getCanonicalPath() + File.separator + TestConstants.RESOURCE_PATH + File.separator + ROOT_DIRECTORY + File.separator + VERSION_DIRECTORY + File.separator + TestConstants.POLICY_DIRECTORY + File.separator + policy; policyLocations.add(policyPath); } catch (IOException e) { //ignore. } } FileBasedPolicyFinderModule testPolicyFinderModule = new FileBasedPolicyFinderModule(policyLocations); Set<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>(); policyModules.add(testPolicyFinderModule); finder.setModules(policyModules); Balana balana = Balana.getInstance(); PDPConfig pdpConfig = balana.getPdpConfig(); pdpConfig = new PDPConfig(pdpConfig.getAttributeFinder(), finder, pdpConfig.getResourceFinder(), true); return new PDP(pdpConfig); }
Example 10
Source File: TestFunctionV3.java From balana with Apache License 2.0 | 5 votes |
/** * Returns a new PDP instance with new XACML policies * * @param policies Set of XACML policy file names * @return a PDP instance */ private static PDP getPDPNewInstance(Set<String> policies){ PolicyFinder finder= new PolicyFinder(); Set<String> policyLocations = new HashSet<String>(); for(String policy : policies){ try { String policyPath = (new File(".")).getCanonicalPath() + File.separator + TestConstants.RESOURCE_PATH + File.separator + ROOT_DIRECTORY + File.separator + VERSION_DIRECTORY + File.separator + TestConstants.POLICY_DIRECTORY + File.separator + policy; policyLocations.add(policyPath); } catch (IOException e) { //ignore. } } FileBasedPolicyFinderModule testPolicyFinderModule = new FileBasedPolicyFinderModule(policyLocations); Set<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>(); policyModules.add(testPolicyFinderModule); finder.setModules(policyModules); Balana balana = Balana.getInstance(); PDPConfig pdpConfig = balana.getPdpConfig(); pdpConfig = new PDPConfig(pdpConfig.getAttributeFinder(), finder, pdpConfig.getResourceFinder(), true); return new PDP(pdpConfig); }
Example 11
Source File: TestXPathV3.java From balana with Apache License 2.0 | 5 votes |
/** * Returns a new PDP instance with new XACML policies * * @param policies Set of XACML policy file names * @return a PDP instance */ private static PDP getPDPNewInstance(Set<String> policies) { PolicyFinder finder = new PolicyFinder(); Set<String> policyLocations = new HashSet<String>(); for (String policy : policies) { try { String policyPath = (new File(".")).getCanonicalPath() + File.separator + TestConstants.RESOURCE_PATH + File.separator + ROOT_DIRECTORY + File.separator + VERSION_DIRECTORY + File.separator + TestConstants.POLICY_DIRECTORY + File.separator + policy; policyLocations.add(policyPath); } catch (IOException e) { //ignore. } } FileBasedPolicyFinderModule testPolicyFinderModule = new FileBasedPolicyFinderModule(policyLocations); Set<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>(); policyModules.add(testPolicyFinderModule); finder.setModules(policyModules); Balana balana = Balana.getInstance(); PDPConfig pdpConfig = balana.getPdpConfig(); pdpConfig = new PDPConfig(pdpConfig.getAttributeFinder(), finder, pdpConfig.getResourceFinder(), true); return new PDP(pdpConfig); }
Example 12
Source File: TestAlgorithmsV3.java From balana with Apache License 2.0 | 5 votes |
/** * Returns a new PDP instance with new XACML policies * * @param policies Set of XACML policy file names * @return a PDP instance */ private static PDP getPDPNewInstance(Set<String> policies){ PolicyFinder finder= new PolicyFinder(); Set<String> policyLocations = new HashSet<String>(); for(String policy : policies){ try { String policyPath = (new File(".")).getCanonicalPath() + File.separator + TestConstants.RESOURCE_PATH + File.separator + ROOT_DIRECTORY + File.separator + VERSION_DIRECTORY + File.separator + TestConstants.POLICY_DIRECTORY + File.separator + policy; policyLocations.add(policyPath); } catch (IOException e) { //ignore. } } FileBasedPolicyFinderModule testPolicyFinderModule = new FileBasedPolicyFinderModule(policyLocations); Set<PolicyFinderModule> policyModules = new HashSet<PolicyFinderModule>(); policyModules.add(testPolicyFinderModule); finder.setModules(policyModules); Balana balana = Balana.getInstance(); PDPConfig pdpConfig = balana.getPdpConfig(); pdpConfig = new PDPConfig(pdpConfig.getAttributeFinder(), finder, pdpConfig.getResourceFinder(), true); return new PDP(pdpConfig); }