org.wso2.balana.PDPConfig Java Examples

The following examples show how to use org.wso2.balana.PDPConfig. 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 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 #2
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 #3
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 #4
Source File: EvaluationCtxFactory.java    From balana with Apache License 2.0 5 votes vote down vote up
public EvaluationCtx getEvaluationCtx(AbstractRequestCtx requestCtx, PDPConfig pdpConfig)
                                                                    throws ParsingException {

    if(XACMLConstants.XACML_VERSION_3_0 == requestCtx.getXacmlVersion()){
        return new XACML3EvaluationCtx((RequestCtx)requestCtx, pdpConfig);
    } else {
        return new XACML2EvaluationCtx((org.wso2.balana.ctx.xacml2.RequestCtx) requestCtx, pdpConfig);
    }
}
 
Example #5
Source File: BalanaPRP.java    From mobi with GNU Affero General Public License v3.0 4 votes vote down vote up
public void setPDPConfig(PDPConfig config) {
    this.config = config;
}