org.wso2.balana.finder.AttributeFinderModule Java Examples

The following examples show how to use org.wso2.balana.finder.AttributeFinderModule. 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: EntitlementEngine.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * Helper method to init engine
 */
private void setUpAttributeFinders() {

    // Creates carbon attribute finder instance  and init it
    carbonAttributeFinder = new CarbonAttributeFinder(tenantId);
    carbonAttributeFinder.init();

    // Now setup attribute finder modules for the current date/time and
    // AttributeSelectors (selectors are optional, but this project does
    // support a basic implementation)
    CurrentEnvModule envAttributeModule = new CurrentEnvModule();
    SelectorModule selectorAttributeModule = new SelectorModule();

    attributeModules.add(carbonAttributeFinder);
    attributeModules.add(envAttributeModule);
    attributeModules.add(selectorAttributeModule);

    for (AttributeFinderModule module : balana.getPdpConfig().getAttributeFinder().getModules()) {
        if (module instanceof CurrentEnvModule || module instanceof SelectorModule) {
            continue;
        }
        attributeModules.add(module);
    }
}
 
Example #2
Source File: BalanaPDP.java    From mobi with GNU Affero General Public License v3.0 6 votes vote down vote up
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 #3
Source File: EntitlementEngine.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
/**
 * Helper method to init engine
 */
private void setUpAttributeFinders() {

    // Creates carbon attribute finder instance  and init it
    carbonAttributeFinder = new CarbonAttributeFinder(tenantId);
    carbonAttributeFinder.init();

    // Now setup attribute finder modules for the current date/time and
    // AttributeSelectors (selectors are optional, but this project does
    // support a basic implementation)
    CurrentEnvModule envAttributeModule = new CurrentEnvModule();
    SelectorModule selectorAttributeModule = new SelectorModule();

    attributeModules.add(carbonAttributeFinder);
    attributeModules.add(envAttributeModule);
    attributeModules.add(selectorAttributeModule);

    for (AttributeFinderModule module : balana.getPdpConfig().getAttributeFinder().getModules()) {
        if (module instanceof CurrentEnvModule || module instanceof SelectorModule) {
            continue;
        }
        attributeModules.add(module);
    }
}
 
Example #4
Source File: Main.java    From balana with Apache License 2.0 6 votes vote down vote up
/**
 * 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 #5
Source File: Utilities.java    From balana with Apache License 2.0 5 votes vote down vote up
/**
 * 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 #6
Source File: KMarketAccessControl.java    From balana with Apache License 2.0 5 votes vote down vote up
/**
 * 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: ImageFilter.java    From balana with Apache License 2.0 5 votes vote down vote up
/**
 * 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));
}