Java Code Examples for org.wso2.balana.finder.AttributeFinder#setModules()
The following examples show how to use
org.wso2.balana.finder.AttributeFinder#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: Main.java From balana with Apache License 2.0 | 6 votes |
/** * Returns a new PDP instance with new XACML policies * * @return a PDP instance */ private static PDP getPDPNewInstance(){ PDPConfig pdpConfig = balana.getPdpConfig(); // registering new attribute finder. so default PDPConfig is needed to change AttributeFinder attributeFinder = pdpConfig.getAttributeFinder(); List<AttributeFinderModule> finderModules = attributeFinder.getModules(); finderModules.add(new SampleAttributeFinderModule()); attributeFinder.setModules(finderModules); // registering new resource finder. so default PDPConfig is needed to change ResourceFinder resourceFinder = pdpConfig.getResourceFinder(); List<ResourceFinderModule> resourceModules = resourceFinder.getModules(); resourceModules.add(new HierarchicalResourceFinder()); resourceFinder.setModules(resourceModules); return new PDP(new PDPConfig(attributeFinder, pdpConfig.getPolicyFinder(), resourceFinder, true)); }
Example 3
Source File: Utilities.java From balana with Apache License 2.0 | 5 votes |
/** * Generates new Policy Decision Point instance. * */ protected static PDP getPDPNewInstance(){ PDPConfig pdpConfig = balana.getPdpConfig(); // registering new attribute finder. so default PDPConfig is needed to change AttributeFinder attributeFinder = pdpConfig.getAttributeFinder(); List<AttributeFinderModule> finderModules = attributeFinder.getModules(); finderModules.add(new SampleAttributeFinderModule()); attributeFinder.setModules(finderModules); return new PDP(new PDPConfig(attributeFinder, pdpConfig.getPolicyFinder(), null, true)); }
Example 4
Source File: KMarketAccessControl.java From balana with Apache License 2.0 | 5 votes |
/** * Returns a new PDP instance with new XACML policies * * @return a PDP instance */ private static PDP getPDPNewInstance(){ PDPConfig pdpConfig = balana.getPdpConfig(); // registering new attribute finder. so default PDPConfig is needed to change AttributeFinder attributeFinder = pdpConfig.getAttributeFinder(); List<AttributeFinderModule> finderModules = attributeFinder.getModules(); finderModules.add(new SampleAttributeFinderModule()); attributeFinder.setModules(finderModules); return new PDP(new PDPConfig(attributeFinder, pdpConfig.getPolicyFinder(), null, true)); }
Example 5
Source File: ImageFilter.java From balana with Apache License 2.0 | 5 votes |
/** * Returns a new PDP instance with new XACML policies * * @return a PDP instance */ private static PDP getPDPNewInstance(){ PDPConfig pdpConfig = balana.getPdpConfig(); // registering new attribute finder. so default PDPConfig is needed to change AttributeFinder attributeFinder = pdpConfig.getAttributeFinder(); List<AttributeFinderModule> finderModules = attributeFinder.getModules(); finderModules.add(new SampleAttributeFinderModule()); attributeFinder.setModules(finderModules); return new PDP(new PDPConfig(attributeFinder, pdpConfig.getPolicyFinder(), null, true)); }
Example 6
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); }