Search in sources :

Example 1 with EffectType

use of com.sun.identity.entitlement.xacml3.core.EffectType in project OpenAM by OpenRock.

the class XACMLPrivilegeUtils method getActionValuesFromPolicy.

static Map<String, Boolean> getActionValuesFromPolicy(Policy policy) {
    if (policy == null) {
        return null;
    }
    List<Rule> rules = getRules(policy);
    if (rules == null) {
        return null;
    }
    Map<String, Boolean> actionValues = new HashMap<String, Boolean>();
    for (Rule rule : rules) {
        Target target = rule.getTarget();
        List<Match> matches = getAllMatchesFromTarget(target);
        Set<String> actions = getActionNamesFromMatches(matches);
        EffectType effectType = rule.getEffect();
        for (String action : actions) {
            actionValues.put(action, (EffectType.PERMIT == effectType) ? Boolean.TRUE : Boolean.FALSE);
        }
    }
    return actionValues;
}
Also used : Target(com.sun.identity.entitlement.xacml3.core.Target) HashMap(java.util.HashMap) Rule(com.sun.identity.entitlement.xacml3.core.Rule) EffectType(com.sun.identity.entitlement.xacml3.core.EffectType) Match(com.sun.identity.entitlement.xacml3.core.Match)

Example 2 with EffectType

use of com.sun.identity.entitlement.xacml3.core.EffectType in project OpenAM by OpenRock.

the class XACMLSchemaFactoryTest method checkEqualAdviceExpressionValues.

/**
     * Check that two advice expression objects contain the same values, return true if so, false otherwise.
     * @param ae1 the first advice expression object
     * @param ae2 the second advice expression object
     * @return true if the advice expression objects contain the same values, false otherwise.
     */
private boolean checkEqualAdviceExpressionValues(final AdviceExpression ae1, final AdviceExpression ae2) {
    if (ae1 == ae2) {
        return true;
    }
    if (ae1 == null || ae2 == null) {
        return false;
    }
    if (!compareStrings(ae1.getAdviceId(), ae2.getAdviceId())) {
        return false;
    }
    EffectType effectType1 = ae1.getAppliesTo();
    EffectType effectType2 = ae2.getAppliesTo();
    if (effectType1 == null && effectType2 != null || effectType1 != null && effectType2 == null) {
        return false;
    }
    if (effectType1 != null && effectType2 != null && !effectType1.equals(effectType2)) {
        return false;
    }
    return (compareListsOfAttributeAssignmentExpression(ae1.getAttributeAssignmentExpression(), ae2.getAttributeAssignmentExpression()));
}
Also used : EffectType(com.sun.identity.entitlement.xacml3.core.EffectType)

Aggregations

EffectType (com.sun.identity.entitlement.xacml3.core.EffectType)2 Match (com.sun.identity.entitlement.xacml3.core.Match)1 Rule (com.sun.identity.entitlement.xacml3.core.Rule)1 Target (com.sun.identity.entitlement.xacml3.core.Target)1 HashMap (java.util.HashMap)1