org.wso2.balana.finder.AttributeFinder Java Examples
The following examples show how to use
org.wso2.balana.finder.AttributeFinder.
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: PDPConfig.java From balana with Apache License 2.0 | 6 votes |
/** * Constructor that creates a <code>PDPConfig</code> from components. * * @param attributeFinder the <code>AttributeFinder</code> that the PDP should use, or null if * it shouldn't use any * @param policyFinder the <code>PolicyFinder</code> that the PDP should use, or null if it * shouldn't use any * @param resourceFinder the <code>ResourceFinder</code> that the PDP should use, or null if it * shouldn't use any * @param multipleRequestHandle whether PDP capable of handling multiple requests or not */ public PDPConfig(AttributeFinder attributeFinder, PolicyFinder policyFinder, ResourceFinder resourceFinder, boolean multipleRequestHandle) { if (attributeFinder != null) this.attributeFinder = attributeFinder; else this.attributeFinder = new AttributeFinder(); if (policyFinder != null) this.policyFinder = policyFinder; else this.policyFinder = new PolicyFinder(); if (resourceFinder != null) this.resourceFinder = resourceFinder; else this.resourceFinder = new ResourceFinder(); this.multipleRequestHandle = multipleRequestHandle; }
Example #4
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 #5
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 #6
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 #7
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 #8
Source File: PDPConfig.java From balana with Apache License 2.0 | 2 votes |
/** * Constructor that creates a <code>PDPConfig</code> from components. * * @param attributeFinder the <code>AttributeFinder</code> that the PDP should use, or null if * it shouldn't use any * @param policyFinder the <code>PolicyFinder</code> that the PDP should use, or null if it * shouldn't use any * @param resourceFinder the <code>ResourceFinder</code> that the PDP should use, or null if it * shouldn't use any */ public PDPConfig(AttributeFinder attributeFinder, PolicyFinder policyFinder, ResourceFinder resourceFinder) { this(attributeFinder, policyFinder, resourceFinder, true); }
Example #9
Source File: PDPConfig.java From balana with Apache License 2.0 | 2 votes |
/** * Returns the <code>AttributeFinder</code> that was configured, or null if none was configured * * @return the <code>AttributeFinder</code> or null */ public AttributeFinder getAttributeFinder() { return attributeFinder; }